Repository navigation
feat(core,objectql,spec,service-record-context,mcp,runtime)!: a context pack is identified by its package and its name; get_record_context selects a pack by its face on both MCP doors - #37291
Conversation
… four package-scoped lists; pack selection reads faces ADR-0150 addendum 2026-11-25: ai_context joins PACKAGE_SCOPED_TYPES, PACKAGE_SCOPED_READ_TYPES, PACKAGE_SLOTTED_METADATA_TYPES and NAMESPACE_UNIQUE_TYPES. get_record_context reads context as a skill prompt's name is read: a face answers its one pack, a bare name resolves by D3 for a caller with no package; the several answer lists each pack by its face with its label. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
…s, D3 for a bare name, the several answer with labels Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
…name is not served, whatever its root; changeset Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
…-context-package-scope
…he keyed plural-read pin's slotted set gains ai_context Claude-Session: https://claude.ai/code/session_01QSeKYohZLmQ1Ug9FKcQtVu Co-authored-by: Claude <noreply@anthropic.com>
…'s registry pattern, so ai_context's hyphenated suffix is read as slotted Claude-Session: https://claude.ai/code/session_01QSeKYohZLmQ1Ug9FKcQtVu Co-authored-by: Claude <noreply@anthropic.com>
…-context-package-scope
…so get_record_context reaches each package's pack by its face Claude-Session: https://claude.ai/code/session_01QSeKYohZLmQ1Ug9FKcQtVu Co-authored-by: Claude <noreply@anthropic.com>
…y its face; the door's member pin lists packageNamespace Claude-Session: https://claude.ai/code/session_01QSeKYohZLmQ1Ug9FKcQtVu Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYohZLmQ1Ug9FKcQtVu Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 7 package(s): 57 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 19 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 197 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 64e40c65818e290efb011da8369d1eacf87cb2cb && git checkout 64e40c65818e290efb011da8369d1eacf87cb2cb
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 4fb03ebbfa5a7bb6771a04bc3f41cb370c440a52 7408543965b4dbbc8e51cf8033e51106d2e2f79d && git checkout -B drift-repro 4fb03ebbfa5a7bb6771a04bc3f41cb370c440a52 && git merge --no-ff 7408543965b4dbbc8e51cf8033e51106d2e2f79d
node scripts/docs-audit/affected-docs.mjs --json 4fb03ebbfa5a7bb6771a04bc3f41cb370c440a52
|
Claude-Session: https://claude.ai/code/session_01QSeKYohZLmQ1Ug9FKcQtVu Co-authored-by: Claude <noreply@anthropic.com>
…mespace is 422 NAMESPACE_CONFLICT, in the semantic entry and the changeset Claude-Session: https://claude.ai/code/session_01QSeKYohZLmQ1Ug9FKcQtVu Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#4 · os-justin · session_01QSeKYo86w1wqy2z2fMrryr Contract reviewServed-tier: What this record is. A delta over my full review of head ① Derived judgmentsCarried from
② Semver level
③ Boundary flags
④ Design judgmentThe delta, S1: closed Carried from
Nits, accepted as they stand (no effect on correctness or the contract). N1: in No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — REWORK · L1 · head
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — ACCEPT · L1 · head
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 维护者速读
Approval request at 2026-11-25T17:46Z. Seat opinion: approve. Seat L1 is ACCEPT (7169974561) and the CONTRACT_REVIEW_TIER review is PASS (7168612536), both on this head. The full dogfood battery passed on this head (os-dev-report 7169906867), and the landing gate reads it at 0 hops. Each of the three narrowings measures 0 on first-party trees. K = 9 and merge-tree is clean. Four nits remain as follow-ups; none needs a head change. |
…ped bucket beside skill and ai_context (objectstack-ai#37330) <!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8ThLXnc2MYoAdJHGZxSsdaA)_ repo:cloud#1 · os-warren · session_01JQwxbZjKjZ947xtTvgJuHX Fixes objectstack-ai#37325 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:用户无感(只改决定记录,不改代码);把你今天定的「按应用+名字区分,都保留」写进记录:两个应用各带的同名知识源都保留、各建各的索引,AI 用「应用前缀-名字」指明是哪一个。 - 为什么做:属于「知识检索平台化」专题;哪些类型按应用区分要先写进记录,后面的实现卡 objectstack-ai#37304(让知识源成为应用包里的一份配置)才能照着做。 - 出错会怎样:记录写偏的话,后面的实现会照着偏的做;这次只有文档,撤回这次合并即可。 - 要你做什么:合并这个 PR,合并就是这条裁定的记录;其中一处超出你的原话、只能由你定:同一个应用前缀下不允许两个应用包带同名知识源(前缀不同的同名知识源照样都保留),不同意就先划掉这一条再合并。 ## What changes Two files under `docs/adr/`: 58 lines added, 1 line changed. No schema, no code, no changeset. **ADR-0150** (Accepted) gains a dated addendum. No ruled sentence is rewritten. - The status line gains one **Amended** clause, dated 2026-11-25, after the `ai_context` one. This is the one changed line: the clause is appended, and nothing before it is edited. - The D1 table gains one row, marked with the date, after the `ai_context` row and before bucket 4. - A new section after the `ai_context` addendum and before D2, "Addendum (2026-11-25): `knowledge_source` joins bucket 3". It writes the maintainer's ruling of that day into the record: the knowledge source type of ADR-0161 K4 is identified by `(package, name)`, in bucket 3 beside `skill` and `ai_context`. The ruling is quoted with its record id in the status clause, at the head of the addendum and in the ADR-0161 note: seat record `7168239918` on the code card, decision card tapped **B 「按应用+名字区分,都保留」** at 2026-11-25T16:34:09Z, against the card's recommendation. The addendum says, in this order: 1. **The type**, and what D2, D3, D4, D5, D6 and D8 mean for it. A package's source is spelled `NS-NAME` where its name crosses the AI face, which is inside `search_knowledge`: the `sources` list of an answer and the `sourceIds` argument. 2. **The principle, read for this type.** The recommendation read a source's name under D1's storage half. The ruling did not, so the keys of a source's index are derived from its identity, as its face is. Three things that reading does not hide are listed. 3. **The tree today**, measured on `main` at `fbb62e1c`. The type is not registered and is in none of the four lists. A source reaches the service through code only. The keys of an index are the bare `id`. 4. **What changes with the bucket**: the service's copy, overlays, owner stamps, uninstall and the keys of an index. 5. **The readers that move.** It names five and moves none. 6. **The follow-up**, the code card objectstack-ai#37304, after this merge. 7. **Past the ruling's words**: seven points, none decided here. One is the maintainer's, two follow from text already ruled, and four are left open for the code card. **ADR-0161** gains one cross-reference note after point 3 of K4 and before K5. No sentence of it is changed. **Not in this PR**, by the card's contract: none of the four lists is edited, no reader is moved and no store is re-keyed. That is the code card's work, after this merge. ## Tests No package is touched, so no package build or test is owed. The checks that read these two files are the docs gates under Verification. ## Acceptance notes - **The chain.** This PR is the ruling's record and step 1 of its execution. The code card objectstack-ai#37304 comes after it and stays open: it takes the four lists, the readers and the store keying in memory, pgvector and turso. - **One decision is the maintainer's alone** (point 1 of "Past the ruling's words"). The ruling record counts "the `domain:server` four lists and readers (precedent PR objectstack-ai#37291)" and names none of them. In that PR the fourth list is `NAMESPACE_UNIQUE_TYPES`: one package holder of a name inside one namespace, refused at install and in `os validate`. So "Two packages shipping one source name both work" holds for two namespaces, and inside one namespace the second is refused. The list's header reserves a further type to the maintainer. The merge accepts this point. Struck, two co-owners of a namespace may ship one name, and the one face they derive is refused at the call. - **Two points follow from text already ruled** and are no new decision. A source name takes the name grammar of buckets 2 and 3, which refuses a `_`-led name that today's `id` pattern admits. And a `409` names only the sources the tool may search (ADR-0161 K9). - **Four points are left open for the code card.** Each is stated in the addendum and decided nowhere in it: what each shape carries (a hit's `sourceId` and `documentId`, a stored document's `sourceId`, the by-name members of the service contract); which coordinate a key carries, the package id or the namespace, and what removes an index left under the old key; which holder a source registered in code is; and an environment source under a name a package later ships. - **The acceptance line of the card**, "The addendum quotes the ruling comment id and the maintainer's words; earlier text of the record unchanged". The id and the words are in all three places named above. ADR-0150's diff has one changed line, the status line, and its old text is a strict prefix of the new text. Every other old line of both files survives, in order. - **The tree moved once during the work.** `main` gained the knowledge splitter (PR objectstack-ai#37287) under six of the files the addendum anchors. `main` is merged into the branch (a merge commit, no rebase and no force-push). Every "today" sentence and every anchor was read again at `fbb62e1c`, and all hold. The two dated readings name that commit. - **Overlap.** PR objectstack-ai#37329 adds a dated note under K8 of the same ADR-0161 file. `node scripts/pm/overlap-check.mjs --branch=claude/project-thread-4uapwf` answered `VERDICT clean exit 0` at this head, against `origin/main` and that PR's head. Whichever of the two lands second merges `main`. - **Line budget.** 58 added and 1 changed; the precedent PR objectstack-ai#37209 was 44 and 1. The difference is the "principle" paragraph, which the precedent did not need because its ruling followed the recommendation, and the seven-point list. - **Citation form.** `check:adr-symbol-anchors` refuses a line anchor under `docs/adr/`, so the record cites `path#Symbol`, and the line numbers are in the table under Verification. - **No changeset.** `docs/adr/` ships in no package, so this PR carries `skip-changeset`. - **Tier H.** This PR stays draft. The merge is the maintainer's, and it is the ruling's record. - **Shallow checkout.** No claim here is read from history dates. - **Attribution lines.** The dispatch asked for a commit trailer that names a model and for the harness's two-line block at the end of this body. The repository's rules ask for the model-free trailer pair and for one footer line under a rule, and those are what the commits and this body carry. - **Noted, not filed.** ADR-0161's status keyword still reads Proposed on `main`, and its own status line says the record is in force from the merge of the PR that carried it. This PR adds one note to that record and does not touch its status line. ## Verification **Read first**, by risk: 1. `docs/adr/0150-…-literal-prefix.md`, "Past the ruling's words" at the end of the addendum (lines 191 to 199). Point 1 is the one decision that is the maintainer's. 2. The same file, "The principle, read for this type" (line 160): how D1's storage half reads for a type the ruling placed against the recommendation. 3. The same file, the D1 table hunk (line 95) and the status line (line 3): one row inserted into a ruled table and one appended clause. Check that both read as additions and change no ruled text. **Two-minute check**: run `node scripts/check-adr-symbol-anchors.mjs`. Expect `4220 anchors across 163 records resolve` and exit 0. Twenty-one of them are this diff's `path#Symbol` anchors. <details> <summary>Measured anchors on main at fbb62e1 (file:line)</summary> | What the addendum says | Where it is read | |---|---| | The type is in no row of the registry; `skill` and `ai_context` open no environment overlay | `packages/spec/src/kernel/metadata-plugin.zod.ts:798` (`DEFAULT_METADATA_TYPE_REGISTRY`), `:1384`, `:1388` | | The service keeps one slot per (package, name) for listed types | `packages/spec/src/api/protocol.zod.ts:2753` (`PACKAGE_SLOTTED_METADATA_TYPES`; `skill` at `:2754`) | | Any other type is keyed by name alone | `packages/metadata/src/package-slotted-store.ts:797` (`storeWriteKey`), `:820` | | The one rule resolves only its listed types, and throws for a type outside the list | `packages/core/src/package-scoped-resolution.ts:245` (`PACKAGE_SCOPED_TYPES`; `skill` at `:270`), `:740`; `packages/objectql/src/package-scoped-resolver.ts:149` | | A by-name read consults (package, name) for listed types | `packages/objectql/src/package-scoped-read.ts:88` (`PACKAGE_SCOPED_READ_TYPES`; `skill` at `:96`) | | One package holder of a name inside a namespace; the list is reserved to the maintainer | `packages/objectql/src/namespace-co-owner-names.ts:96` (`NAMESPACE_UNIQUE_TYPES`), `:27` | | A source reaches the service through code only | `packages/services/service-knowledge/src/knowledge-service-plugin.ts:91` (`KnowledgeServicePlugin`), `:44`, `:220` | | One map by `id`; a second registration replaces the first with a warning | `packages/services/service-knowledge/src/knowledge-service.ts:121` (`KnowledgeService`), `:123`, `:166`, `:168` | | A document id is the source's `id`, a `:` and the record id | `packages/services/service-knowledge/src/knowledge-service.ts:1570` (`documentIdFor`), `:1571` | | An adapter is handed the whole source | `packages/spec/src/contracts/knowledge-adapter.ts:33` (`AdapterContext`), `:35` | | The one in-tree store keyed by the bare `id` | `packages/plugins/knowledge-memory/src/index.ts:44` (`KnowledgeMemoryAdapter`), `:48`, `:55` | | The push door that takes a document id from a caller | `packages/spec/src/contracts/knowledge-service.ts:107` (`IKnowledgeService`), `:127` | | The tool lists each source by its `id`; a hit shows `sourceId` and `documentId` | `packages/services/service-knowledge/src/knowledge-tools.ts:61` (`SearchKnowledgeSourceSummary`), `:70`, `:72`, `:222` | | An unknown `sourceIds` entry is refused `NOT_FOUND` | `packages/services/service-knowledge/src/knowledge-tools.ts:246` (`createKnowledgeTools`), `:257`, `:260` | | Today's `id` pattern admits a `_`-led name; the bucket's pattern does not | `packages/spec/src/ai/knowledge-source.zod.ts:174` (`KnowledgeSourceSchema`), `:176`; `packages/spec/src/kernel/address-grammar.ts:68` (`ROUTER_ADDRESSABLE_NAME_PATTERN`) | | The one face derivation | `packages/spec/src/ai/face-name.ts:86` (`deriveAiFaceName`) | | A skill prompt's name: a face, else a bare name by the one rule | `packages/mcp/src/skill-prompts.ts:373` (`lookupSkillPrompt`) | | The owner stamp's judge, and the collections it judges | `packages/spec/src/kernel/collection-item-owner-stamp.ts:129` (`judgeCollectionItemOwnerStamp`), `:100` | | The type's row is not among the served overrides | `packages/metadata-protocol/src/protocol-package-bindings.ts:388` (`SEALED_ROW_SERVED_OVERRIDE_TYPES`) | | Uninstall, the registry's half | `packages/objectql/src/registry.ts:5328` (`uninstallPackage`) | | Uninstall, the service's half | `packages/metadata/src/metadata-manager.ts:2880` (`unregisterPackage`) | Absence readings at the same commit, each with a positive control: - `knowledge_source` in the four list files, in `packages/metadata/src/package-slotted-store.ts` and in the registry's rows: 0 lines each. Control: `skill` is in the first three lists and in the registry, at the lines the table gives. - A stack collection: `knowledgeSources` in `packages/spec/src/stack.zod.ts`, 0 lines. Control: `aiContexts`, 3 lines. - `knowledge_source` under `packages/`, `examples/`, `ui/`, `skills/` and `content/`: 0 files. Control: `ai_context`, 60 files. - `KnowledgeServicePlugin` or `registerSource` under `examples/`: 0 files. Control: 25 files under `packages/`. - Tracked paths under `knowledge-pgvector` or `knowledge-turso`: 0. Control: `packages/plugins/knowledge-memory`, 10 files. - Before this diff, ADR-0161 named ADR-0150 on 0 lines (control: ADR-0088, 7 lines), and ADR-0150 held the word "knowledge" on 0 lines (control: `ai_context`, 6 lines). </details> <details> <summary>Local gates at head 05f35b6: 21 derived, 21 run, all exit 0</summary> Derived with `node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands`, and reconciled with `--ran`: ``` Run reconciliation — 21 derived, 21 run, 0 NOT-MEASURED, 0 UNRUN. ✓ dispatch-gates --ran: 21 derived famil(ies) accounted for — 21 run, 0 NOT-MEASURED (a DERIVED zero — all 21 recorded an exit code and none of them is 3). ``` Each exit code was captured before any pipe: ``` 0 node scripts/check-adr-links.mjs 1225 relative link destination(s) under docs/adr/ resolve 0 node scripts/check-adr-links.mjs --self-test 0 node scripts/check-closing-keyword-parity.mjs 3 parsers agree on all 9 keywords 0 node scripts/check-closing-keyword-parity.mjs --self-test 0 node scripts/check-comment-mask-corpus.mjs 23929 files, 0 disagree, 0 unparseable 0 node scripts/ci/plan-test-core-shards.mjs --self-test 0 pnpm --filter @objectstack/lint run check:doc-formula-expressions 0 pnpm check:adr-anchors 132 anchored file(s), every governing ADR still referenced 0 pnpm check:adr-index docs/adr/README.md is current, every record parsed 0 pnpm check:adr-symbol-anchors 4220 anchors across 163 records resolve 0 pnpm check:ci-filter-parity 0 pnpm check:closed-ceremony-text 0 pnpm check:cross-package-test-inputs 0 pnpm check:doc-authoring 0 pnpm check:driver-memory-census 0 pnpm check:gitlink-declared 0 pnpm check:nul-bytes no raw ASCII control bytes 0 pnpm check:pm-governed-merges 0 pnpm check:pm-prior-rulings 0 pnpm check:refd-timer-probe 0 pnpm check:watch-hint-literal ``` `check:doc-formula-expressions` reads the compiled output of `@objectstack/formula` and `@objectstack/lint`. Those two and their dependencies were built first on the merged tree, under the shared verify lock (`VERDICT command-exit 0`). `docs/adr/README.md` is generated from each record's status keyword. ADR-0150's keyword stays Accepted and ADR-0161's stays Proposed, so the index does not change and is not in this diff. Also at this head: `node scripts/check-commit-card-trailers.mjs --range origin/main..HEAD` exits 0 over the 3 commits of the branch. Not measured locally, and CI's to run: the type-check lanes, the `Plan Test Core shards` job and the governed-merges audit, which take values only a CI run has. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01JQwxbZjKjZ947xtTvgJuHX)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
…he record-context docs name both mounts (objectstack-ai#37409) <!-- claude-projects-attribution: {"github_login":"os-bill"} --> _Requested by **Bill** · [project thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wgXTK3Lp9k96oinCGTRnfrNo)_ Fixes objectstack-ai#37177 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:替客户写应用的 AI 助手,现在能从随产品发布的技能文档里学会怎样写「资料包」,也就是挑出一条记录的哪些字段、关联列表和正文交给 AI;产品本身的行为没有变化。 - 为什么做:属于「在一条记录上问 AI」专题;资料包这个新的元数据类型此前在技能文档里只有一个名字,作者无从下笔。 - 出错会怎样:最坏是技能文档某句话教错,AI 写出的资料包被校验拒收或读到的内容比预期少;已有应用不受影响,撤回即可恢复。 - 要你做什么:批准这次技能文件改动(受管文件,需要你批准后才能合入)。 ## What changes **New reference `skills/objectstack-ai/references/context-packs.md`** (111 lines, 1454 tokens). It teaches authoring an `ai_context` pack from what `main` at `9ffe37153` enforces: - the six pack keys and the six keys of a `related` entry, with their bounds (30 fields, 3 related lists, 10 columns, `limit` 1 to 20), and that an unknown key or a pack over a bound is refused at parse; - a related list's `where` / `orderBy` / `limit` (objectstack-ai#37354): the admitted operators, literal comparands only, `order` not `direction`; - when to use fields, a related list or the body, and how the body is carried (whole up to 8,000 characters, else an outline with anchors, else cut and marked); - serving and calling: `requires: ['record-context']` or a `plugins` mount (objectstack-ai#37303), the call's four arguments, the answer's three parts; - pack identity (objectstack-ai#37291): package and name, one pack per name in a namespace (`422 NAMESPACE_CONFLICT`), `context` takes the face `NAMESPACE-NAME`, a bare name two packages hold is refused `409 RESOURCE_CONFLICT`, and the `/meta/ai_context/NAME` read needs `?package=` for such a name; - what the caller is not shown, and the five `os validate` rules that report an author's mistake the tool keeps silent about. **Pointers in the two SKILL.md files, paid by deleting restatement in the same file.** Neither SKILL.md ceiling row moves. - `skills/objectstack-ai/SKILL.md`: a five-line "Context packs" section, a `get_record_context` row in the MCP tools table, and the frontmatter description and tags name the context pack. - `skills/objectstack-platform/SKILL.md`: the `requires` token row says what `record-context` serves and links the reference; the ADR-0150 list of names "identified by package and name" gains context packs. **N1 and N2 of scope note 7166997849 (prose only).** - N1: the `aiContexts` `.describe()` and its TSDoc in `packages/spec/src/stack.zod.ts` no longer read the token as the only serving condition. They name both mounts: the CLI mounts the service where `requires` includes `record-context`, and a host that composes its own kernel lists `RecordContextServicePlugin` in `plugins`. Regenerated mirror: `content/docs/references/api/package-api-assembled.mdx`. - N2: `packages/services/service-record-context/README.md` and the `RecordContextServicePlugin` docblock teach the token beside the `plugins[]` mount. - Patch changeset for `@objectstack/spec` and `@objectstack/service-record-context`. **Eval case 11** in `skills/objectstack-ai/evals/skills-tools-knowledge.json`: the card's prompt ("give the AI a customer's open opportunities and notes"). **One new ratchet row** in `scripts/check-skills-token-ratchet.mjs` for the new reference, pinned at the measurement (5813 bytes, `ceil(5813 / 4) = 1454`, zero headroom). It is the seat's claim amendment 2 on the card, comment 7179788843: "one new row in check-skills-token-ratchet.mjs for the new references/context-packs.md, pinned at the measured size". Container & model: `M`, `mode:thread`, `model: CONTRACT_REVIEW_TIER (MANDATORY for skills/**, served at tier; claim amendment 7179771295)`, `effort: high` ### Skills readings (base `9ffe37153`, head `e9b2056f`) | File | Lines | Tokens (`ceil(bytes / 4)`, the ratchet's count) | |:--|:--|:--| | `skills/objectstack-ai/SKILL.md` | 485 to 487 | 6787 to 6798 (ceiling 6801, unchanged) | | `skills/objectstack-platform/SKILL.md` | 422 to 422 | 6149 to 6149 (ceiling 6149, unchanged) | | `skills/objectstack-ai/references/context-packs.md` | 0 to 111 | 0 to 1454 (new row 1454) | | `skills/objectstack-ai/evals/skills-tools-knowledge.json` | 105 to 115 | 2668 to 2997 (eval fixture, not ratcheted) | | All `SKILL.md` files together | 4959 to 4961 | | | Whole `skills/` tree | 23130 to 23253 | ratcheted authored 198131 to 199596; bundle total 297515 to 299309 | ### What was deleted to pay for the pointers, and where each fact still lives The discipline is the standing ruling of record 6513306068, quoted verbatim: 「A:先削重复,余额按实测提高」. Only its first half is used here: restatement is cut, and no SKILL.md row is raised. `skills/objectstack-ai/SKILL.md` (+11 tokens net, inside the 14 of headroom it had): 1. The `Agent → Skill → Tool` diagram. Still taught: a skill's `tools` row ("Tool names this skill grants"), "An agent's tool set is the union of its surface-compatible skills' tools" (Platform agents), and the three captions by the Skill Configuration table, the Actions dispatch table and the Platform agents section. 2. "You usually don't author tool definitions by hand for action invocation." Still taught by that section's own heading ("the default path"), ladder rung 3, and "Default: declare no tool records" (Tool metadata). 3. The Verify block's `# or: os build` comment line. Still taught in `skills/objectstack-platform/references/operations.md` ("os build # the same three gates, plus emits dist/objectstack.json"), which the section points to. This home is in another file. 4. The Knowledge example's `// or 'memory' for dev/test` comment. Still taught by the Wiring paragraph above it. `skills/objectstack-platform/SKILL.md` (net 0): 1. "Embed any domain prefix directly in the name (e.g. `name: 'crm_account'`)". Still taught by the next two paragraphs (`manifest.namespace`: every `object.name` must start with `crm_`; "Which names carry the namespace"). 2. "(one `task.object.ts` per object)". Still taught by the Naming Conventions row (`{name}.{type}.ts`, `task.object.ts`). 3. "handed to the stack key of its name" on the barrel sentence. Still taught by The Template's barrel bullet. ## Tests <details><summary>Example validity (card What 3)</summary> - The reference's `os:check` block parsed with the built `AiContextSchema`: `parse success: true`. Seven controls on the same pack were each refused: `limit: 21`, a `description` key, a `$contains` operator, 4 related lists, 31 fields, 11 related columns, `direction` in `orderBy`. - `os validate` on a scratch stack (objects `account` and `opportunity`, the block's pack, `requires: ['record-context']`): `Validation passed`, exit 0, no `ai-context-*` warning. Control on the same stack with a `where` field the child lacks and a `body.field` that is not long text: `ai-context-field-unknown` at `aiContexts[0].related[0].where` and `ai-context-body-not-long-text` at `aiContexts[0].body.field`. The scratch stack was deleted. - `pnpm --filter @objectstack/spec run check:skill-examples`: `352 prose examples type-check across 3 surface(s)`, exit 0. </details> <details><summary>Eval case 11, graded with `gradeAnswer` (packages/qa/scenarios/src/skill-evals/grade.ts)</summary> - A reference answer (an `aiContexts` entry with the related `opportunity` list filtered by `stage`, `body: { field: 'notes' }`, `requires: ['record-context']`): `{"pass":true,"missing":[],"forbidden":[]}`. - Control, the wrong shape (an object-level `aiReadable`, a top-level `filter:`, `direction:`): `{"pass":false,"missing":["opportunity","related","where","body","notes","record-context"],"forbidden":["filter:","direction:","aiReadable"]}`. </details> <details open><summary>Eval case 11, run against a model (seat L1 item S1, record 7181297604)</summary> One round of the repository's runner on head `e9b2056f`: `pnpm --filter @objectstack/scenarios skill-evals --skills objectstack-ai --concurrency 4` (the runner selects by bundle, not by case, so all 11 cases ran; 22 of 22 turns, each case once with the bundle installed and once without; subscription login, no API key; the served model is in the round's run records and is not written here, repository rule). - **Case 11, with the skill: `pass`**, `missing: []`, `forbidden: []`. The turn launched `objectstack-ai` and read `objectstack-ai/references/context-packs.md`. - **Case 11, without the skill: `fail`**, `missing: ["related","where","body"]`, `forbidden: ["filter:"]`. The no-skill answer reached for a top-level `filter:`, which is the mistake the case forbids. - The pack in the with-skill answer, as the model wrote it: ```typescript export const AccountBrief: AiContext = { name: 'account_brief', label: 'Customer brief: open opportunities and notes', object: 'account', fields: ['name'], related: [ { object: 'opportunity', field: 'account', fields: ['name', 'stage'], where: { stage: { $nin: ['closed_won', 'closed_lost'] } }, limit: 20, }, ], body: { field: 'notes' }, }; ``` - The same answer adds `requires: ['record-context']` on the stack and says that without it nothing serves `get_record_context`. - That literal through `AiContextSchema.safeParse` on this head: `model answer pack parse success: true`. Not measured: `os validate` on it (the answer names no object definitions to validate against). - **The other ten cases, same round:** with the skill 9 of 11 pass, without it 0 of 11. Cases 5 and 6 fail with the skill (missing `aiExposed`; missing `signed-in session`). The same round on the base text (`skills/objectstack-ai` as of `9ffe37153`, 10 cases, 20 of 20 turns): 8 of 10 with the skill, and the same two cases fail (5 missing `skills`, `aiExposed`; 6 missing `signed-in session`, `refused`). Both cases are red before this diff, on sentences this diff does not touch; they are not fixed here. - One repeat per arm, so each figure is one draw, not a rate. </details> <details><summary>Packages and gates (local, head `e9b2056f` unless a line says otherwise)</summary> - `pnpm --filter @objectstack/spec test`: `Test Files 896 passed (896)`, `Tests 28442 passed | 1 todo`; the lock's line `VERDICT command-exit 0`. - `pnpm --filter @objectstack/service-record-context typecheck`, its `test` (`Test Files 2 passed`, `Tests 99 passed`) and `pnpm --filter @objectstack/spec typecheck`: one locked run, `VERDICT command-exit 0`. - `pnpm --filter @objectstack/spec check:generated`: 2 of 14 stale (skill docs, `content/docs/references/**`); `--fix` regenerated those two and both then checked clean. - `node scripts/check-skills-token-ratchet.mjs`: exit 0, `61 authored bundle file(s) within their ceilings`; its `--self-test`: `104 cases pass`. - Derived families (`node scripts/pm/dispatch-gates.mjs --commands`): 138. Reconciliation at `e9b2056f`: `138 derived, 137 run`, and the 138th, `pnpm check:pm-dispatch-gates`, was run on its own afterwards: exit 0. - 133 commands exited 0 on `f3cbf52a`. The last commit changed only `skills/objectstack-platform/SKILL.md`, and the eleven gates that read the skills were re-run on `e9b2056f`: all exit 0. - `pnpm check:skill-top-level-keys` exited 1 on `f3cbf52a`: its self-test pins the sentence "the top level refuses it and the stack fails to load" in the platform skill, which I had cut as restatement. `e9b2056f` restores the sentence and pays with a different cut. Exit 0 on `e9b2056f`. - `pnpm --filter @objectstack/spec run check:skill-examples` exited 3 first (`PREREQUISITE NOT MET`, `packages/client-react/dist` not built), and 0 after that package was built. - NOT MEASURED: `node scripts/check-plugin-teardown-shape.mjs --self-test`, reason: exit 3, the shallow clone cannot reach the commit its fixture is pinned to. NOT MEASURED: `pnpm check:dual-build-cjs-loads`, reason: exit 3, some packages have no `dist/` here (only the CLI and client closures were built). CI runs both. - `test:repo` and the repo-wide lint were not run locally; they are CI's (`Test Core`, `Lint & Repo Gates`). </details> No ablation: the diff changes documentation, one ratchet row and one eval fixture, and no behaviour a test pins. ## Acceptance notes - **Size.** The reference is 1454 tokens. My estimate to the seat before writing was 600 to 800. The file holds a whole metadata kind (two key tables, the body, serving, pack identity, the validate rules), and I did not find a smaller form that keeps every item the card and its three scope notes ask for. - **N1 and the hosted kernel.** Scope note N1 says the hosted kernel does not serve the tool yet. That lives in another repository, which I cannot read from here, so no sentence states it. The new text says what `main` does: a host without the service serves no such tool. - **A related object the caller cannot read.** The reference teaches what `main` does today: the whole call is refused `403 PERMISSION_DENIED` (`record-context-tools.ts`, step 4a). ADR-0160 D3 as amended says such a child is left out and stated. The PR that lands the amendment owes this reference one sentence. - **Not taught, because `main` does not have it:** a skill's `context` key (ADR-0160 D8; `SkillSchema` has no such key, though the pack `name` description in `ai-context.zod.ts` already mentions it), and the total bound on long-text cells of a related list (ADR-0160 D3, amended 2026-11-25; the service bounds only the body). - **Possible defect, not fixed here.** `os validate` reported `ai-context-field-unknown` for `owner_id` in a pack's `fields` on an object that does not declare `owner_id` itself (the platform adds it). Measured: the warning, on the scratch stack above. Not measured: whether `get_record_context` carries the field at run time. The example avoids the field. Reported to the seat in the dev report. - `content/docs/ai/skills-reference.mdx` is regenerated from the changed frontmatter (`gen:skill-docs`), not hand-edited. - The model identifier is not written in this body (repository rule); the tier is named by its word. ## Verification Two-minute check: `node scripts/check-skills-token-ratchet.mjs`. Expect `61 authored bundle file(s) within their ceilings`, with `context-packs.md 1454 / 1454`, `objectstack-ai/SKILL.md 6798 / 6801` and `objectstack-platform/SKILL.md 6149 / 6149`. Read first: (1) `skills/objectstack-ai/references/context-packs.md` against `packages/spec/src/ai/ai-context.zod.ts` and `packages/services/service-record-context/src/record-context-tools.ts`; the risky part is the section "What the caller is not shown". (2) The deletions listed above, in the two SKILL.md diffs. (3) `packages/spec/src/stack.zod.ts`, the `aiContexts` description. --- _Generated by [Claude Code](https://claude.ai/code/session_01Utp6CaWzgwG1QYaiBidBCK)_ <!-- signed: repo:objectstack#5 · os-bill · session_01Utp6CaWzgwG1QYaiBidBCK --> --------- Co-authored-by: Claude <noreply@anthropic.com>
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ
Fixes #37216
Clause-②: yes (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up #37177
维护者速读
7408543965b4dbbc8e51cf8033e51106d2e2f79d。What changes
ADR-0150's addendum (PR #37209, merged by the maintainer) puts the context pack in bucket 3 beside
skill: a pack is identified by its package and its name.ai_contextjoinsPACKAGE_SCOPED_TYPES(packages/core/src/package-scoped-resolution.ts, the one ADR-0150 D3 rule),PACKAGE_SCOPED_READ_TYPES(packages/objectql/src/package-scoped-read.ts, the/metaby-name read and its?package=qualifier),PACKAGE_SLOTTED_METADATA_TYPES(packages/spec/src/api/protocol.zod.ts, the metadata service's per-(package, name)slot; uninstall drops one package's pack and keeps another's) andNAMESPACE_UNIQUE_TYPES(packages/objectql/src/namespace-co-owner-names.ts, D2's refusal of a second holder inside one namespace, at install and inos validate).packages/services/service-record-context/src/read-set.ts). Candidates are still the packs rooted onobjectName.contextis read as a skill prompt's name is: a face (NS-NAME,deriveAiFaceName) answers its one pack; a bare name resolves by D3 as a caller with no package (the environment's pack, else the one package holder, else409 RESOURCE_CONFLICTnaming each candidate by its face).RecordContextDoorgains an optionalpackageNamespace(packageId); the tool description teachesNAMESPACE-NAME./mcproute (packages/runtime/src/domains/mcp.ts) implementspackageNamespacethroughpackageNamespaceOf, on the engine resolved beside thelistContextPacksread, aslistSkillsdoes. The stdio bridge (packages/mcp/src/stdio-data-bridge.ts) implements it from itsengine's registry (theobjectqlservice, the same recordinstalledPackageNamespacereads for skill prompts). Both sit on top of fix(mcp,runtime): get_record_context reads a package's context packs on both MCP doors #37255'sstripReadDecorationslisting, unchanged.skill): a package-lessai_contextrow under a name a package ships is that holder's customization and is not served, read at(type, name)whatever the row's root. Measured by a §5 pin with a control inpackages/metadata-protocol/src/protocol.reads-environment-only.test.ts.packages/spec/src/migrations/entries/semantic/18.ai-context-package-scoped-name.ts, registered by the changeset'sregistered ai-context-package-scoped-namemarker.Narrowings, each measured on first-party trees (objectstack at
d7f299c0, re-read at this head; hotcrm at9b735103): the one declarer of packs,examples/app-showcase(src/ai/record-context.ai-context.ts), ships two packs of different names (showcase_project_brief,showcase_task_notes) in one package; hotcrm declares none.422 NAMESPACE_CONFLICT) and byos validateGET /api/v1/meta/ai_context/NAMEwith no package, for a name two packages hold: first match becomes409 RESOURCE_CONFLICTTests
packages/mcp/src/mcp-record-context-tools.test.ts: a new top-leveldescribeon the stdio bridge whose engine's registry places two packages: each same-name pack reached by its face, alike over MCP-over-HTTP and stdio; the bare name refused409naming both faces; a control engine with no registry spells each pack bare, so no face reaches one (404).packages/runtime/src/mcp-record-context-tools-bridge.test.ts: in the real-protocol/mcpharness, two packages of two namespaces shiprcd_briefon one root: each is reached by its face, and the bare name is refused409naming both. The door's member pin listspackageNamespace.packages/services/service-record-context/src/__tests__/record-context-tools.test.ts: a new top-leveldescribefor selection by(package, name): each of two packages' same-name packs reached by its face; the bare name refused409naming both faces with nothing read; uninstalling one holder keeps the other; environment pack first under D3; the root narrows before D3 picks; the several answer by face and label in en and zh-Hans, with the blank-label fallback; a door withoutpackageNamespace.packages/metadata/src/metadata-manager-keyed-plural-read.test.ts: the pinned slotted set gainsai_context, so every plural-read case runs for it.packages/metadata/src/loaders/database-loader.test.ts(metadata: the boot priming pass primes one holder per name for unbundled slotted types, so a bare read of a two-holder name answers the last row saved instead of 409 (epic red line 2) #32521 priming): the two host-file cases spelt the host's filehelper.TYPE.yml, which the pass never reads forai_context(the registry declares**/*.ai-context.yml). They now spell the file from the type's registry pattern. Every assertion is unchanged, and theai_contextcases assert the slotted behaviour every other type already had.registry-namespace-co-owner-names,package-scoped-exact-qualifier,package-scoped-e8-readers,manifest-service-residual-namespace-name, the CLI'snamespace-co-owner-names) listai_contextwhere it moved.Acceptance notes
packageNamespace(packages/runtime/src/domains/mcp.ts,packages/mcp/src/stdio-data-bridge.ts) waited for PR fix(mcp,runtime): get_record_context reads a package's context packs on both MCP doors #37255 (get_record_context finds no context pack a real protocol serves: getMetaItems adds _diagnostics, the strict AiContextSchema parse drops every pack #37243), which edits the samelistContextPacksregions. It landed after fix(mcp,runtime): get_record_context reads a package's context packs on both MCP doors #37255 merged:mainwas merged in at057cedfa(no rebase), and the doors were built on itsstripReadDecorationslisting (commit1deea31f).record-context-tools.zod.ts'scontextdescribe still says "by name"; the addendum makes it a face or a bare name. Noted for 记录 AI 问询 8:技能键 context,MCP 技能提示词可带记录参数 #37141, which owns that key.packages/spec/src/api/protocol.zod.ts) is run by the zone, not here.Verification
Local readings
Each run under
scripts/pm/os-verify-lock.sh, exit taken from itsVERDICT command-exitline. Readings taken at6cb32813(main merged at057cedfa, which carries #37255). The head is now74085439: the two commits since change only the changeset'sClause-②line and the semantic entry'sreasonplus the first BREAKING bullet (422 NAMESPACE_CONFLICT). The dogfood battery was re-run on74085439(see below). The suites the door commits touch were re-run there; the rest were read atc61fb9f7, and the merge brought no change to their packages (packages/spec,core,objectql,metadata,metadata-protocoluntouched by it).pnpm --filter @objectstack/mcp test6cb32813pnpm --filter @objectstack/runtime test6cb32813pnpm --filter @objectstack/service-record-context test6cb32813typecheckmcp, runtime6cb32813pnpm --filter @objectstack/core testc61fb9f7pnpm --filter @objectstack/objectql testc61fb9f7pnpm --filter @objectstack/metadata testc61fb9f7pnpm --filter @objectstack/metadata-protocol testc61fb9f7pnpm --filter @objectstack/spec exec vitest run src/migrations src/apic61fb9f7pnpm --filter @objectstack/cli exec vitest run --project unit src/utils/namespace-co-owner-names.test.tsc61fb9f7typecheckservice-record-context, metadata, core, objectql, metadata-protocol, spec, clic61fb9f7The #32521 host-file pins before the fixture fix: 2 failed / 539 passed (the two
ai_contexthost-file cases; the pass read no file). After: 541 passed, 23 of themai_contextcases.Ablations (once each, after committing; restore proven by blob equal to HEAD): deleting the stdio bridge's
packageNamespacemember turns both face cases of the new mcpdescribered (2 failed, the control passes). Deleting the/mcpdoor's member turns the runtime face case and the member pin red (2 failed).The CLI
integrationlayer andtest:repowere not run locally; CI runs them.Gate sweep (dispatch-gates --commands)
node scripts/pm/dispatch-gates.mjs --commandsat6cb32813: 105 derived commands, each run with its exit code recorded.--ran: 105 derived, 105 run, 0 NOT MEASURED (a derived zero: every line carries its exit code).pnpm check:type-check-debt: exit 3 on the first run (lock queue-timeout behind the dogfood run, nothing measured). Re-run under the lock: exit 0.check:adr-0087-registration:registered ai-context-package-scoped-name (new here: ai-context-package-scoped-name).Dogfood battery
Head
74085439(the current head; the os-dev-report is #37216 comment 7169906867): the full battery under the lock gaveVERDICT command-exit 0· Test Files 487 passed, 3 skipped (490) · Tests 4128 passed, 68 skipped (4196) · no failures. Earlier reading, head6cb32813,pnpm turbo run build --filter='@objectstack/dogfood^...'(exit 0), thenpnpm --filter @objectstack/dogfood testunder the lock:VERDICT command-exit 0· Test Files 487 passed, 3 skipped (490) · Tests 4128 passed, 68 skipped (4196) · no failures. (Also run atc61fb9f7, before the door commits: the same counts.)Read first:
packages/services/service-record-context/src/read-set.ts(selectContextPack, the face / D3 order),packages/spec/src/api/protocol.zod.ts(the slot list, a contract surface),packages/mcp/src/stdio-data-bridge.ts(installedPackageNamespaceOf, the stdio door's new member).Two-minute check:
pnpm --filter @objectstack/service-record-context exec vitest run src/__tests__/record-context-tools.test.ts→ 65 passed, including "the bare name two packages hold is refused 409, naming both faces".Provenance
Opened by seat repo:objectstack#4 on the maintainer's authorization in the seat session (「#37216 开 PR 放行」). The dev session's (
session_01QSeKYohZLmQ1Ug9FKcQtVu, zone a4-A) own relaypr_createwas refused by its permission check and not retried; the dev sent the prepared body. The seat changed the dev'sClause-②: no (narrowing)toClause-②: yes (narrowing). A narrowing arm is legal with either value;yesis right here because the diff also widens published surface:?package=on the history and rollback doors forai_context, a face inget_record_context'scontext, and newservice-record-contextexports. Branchclaude/issue-37216-ai-context-package-scope@74085439.🤖 Generated with Claude Code
https://claude.ai/code/session_01QSeKYpEsWWE9Y5YtSsDgqZ