Repository navigation
Commit 6211ddf
docs(adr): ADR-0150 addendum — ai_context joins the package-scoped bucket beside skill (#37209)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBEaJzgBWzjWCNjBjkVoeRto)_
repo:objectstack#3 · os-support-ai · session_01WGufzi13yZRqVcp2mGonWK
Fixes #37180
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户能看到什么变化:用户无感(只改决定记录,不改代码);提议两个应用各带的同名 AI
资料包按「应用+名字」分开认,和技能现在的做法一样,AI 点名某个应用的资料包时用「应用前缀-名字」的写法。
- 为什么做:属于「记录级 AI 问询」这项工作;现在同名的资料包在系统里只留后装的那一份,规则要先定,再由后续实现卡
#37216(把资料包加进按应用区分的名单)落地,而它必须排在 #37141(让技能写明用哪个资料包)之前。
- 出错会怎样:规则定错的话,后面的实现会照着错的做;本次只有文档,撤回这次合并即可。
- 要你做什么:这条只能由你本人定,合并就等于批准,其中两处超出卡面原话(AI
用「应用前缀-名字」点名资料包;同一应用前缀下不许两个应用包带同名资料包);不同意就不合并,那样只保留「同一对象上两个同名资料包不替用户挑、一律拒绝」这一条。
## What changes
Two files under `docs/adr/`: 44 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. 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, between bucket 3 and
bucket 4.
- A new section at the end of D1, "Addendum (2026-11-25): `ai_context`
joins bucket 3". It proposes that the context pack type of ADR-0160 is
identified by `(package, name)`, in bucket 3 beside `skill`.
The addendum says, in this order:
1. **The type**, and what D2, D3, D6 and D8 mean for it. A package's
pack is spelled `NS-NAME` where its name crosses the AI face.
2. **The tree today**, measured on `main` at `0a1b69c0`. The type and
its pack selection are on `main`. The registry keeps each package's
item. The metadata service keeps one copy per name, the one registered
last.
3. **What changes with the bucket**: the service's copy, overlays, owner
stamps (unchanged) and uninstall.
4. **The readers that move.** It names three and moves none.
5. **The follow-up**, #37216, which lands before row 8 (#37141).
6. **The interim rule**: two parsed packs that share a name and a root
are never chosen between.
7. **Past the card's words**: two points that are the maintainer's
decision alone, and one that is no new decision.
**ADR-0160** gains one cross-reference note under D1, which also names
the follow-up and its order. No sentence of it is changed.
**Not in this PR**, by the card's contract: `PACKAGE_SCOPED_TYPES` is
not edited and no reader is moved. That is #37216's work, after the
ruling.
## Round 2
The contract review of the first head passed with two should-fix
findings and four nits. This head closes them.
- **S1, the tree moved.** `main` gained the type and the tool (#37173)
and the ADR-0160 amendment (#37196) after the first measurement. `main`
is merged into the branch (a merge commit, no rebase and no force-push),
and every "today" sentence is re-measured at `0a1b69c0`. The addendum
now cites the merged code. "Nothing first-party is refused" is restated
against the showcase app, the one declarer: one package, two packs of
different names on different roots. `objectstack-ai/hotcrm` at
`b1ea6fcc` declares none.
- **S2, who rules.** The addendum no longer lets any authorized approval
be its ruling. Points 1 and 3 are the maintainer's alone, so the record
is ruled by the maintainer's own merge or word. Point 2 is stated as
following from ADR-0160 D4, not as a new decision.
- **N1.** The interim rule no longer says "one answer". A `context` that
names the two packs answers `409`. So does an omitted `context` when
theirs is the only name on the root. With another name on the root, an
omitted `context` gets the several-packs answer, which lists the shared
name once. The first match is taken in none of these.
- **N2.** The overlays bullet now says a package-less row under a name a
package ships is not served, that this is D4 as for `skill`, and that
#37216 measures it.
- **N3.** The follow-up is filed as #37216 and named in both records.
- **N4.** The no-hyphen premise of the face is anchored to the name
pattern.
## 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. #37216 implements it and is
blocked by this PR. #37141 (the skill key) waits for #37216, because the
one rule throws for a type outside `PACKAGE_SCOPED_TYPES`.
- **Two decisions are the maintainer's alone.**
1. Bucket 3 and not bucket 2: a package's pack is spelled `NS-NAME` in
the tool's `context` argument. This widens D6 from the names a server
lists to the value of an argument. The alternative, an optional
`namespace` input on the tool, adds a key to two shapes ADR-0160 has
ruled.
2. Child N's predicate carries the install refusal: the type joins
`NAMESPACE_UNIQUE_TYPES`, whose header reserves a further type to the
maintainer.
- **Not a new decision.** The root object narrows the candidates before
the one rule picks. ADR-0160 D4 already requires it: step 3 selects
among the packs rooted on the requested object, and the naming bound
lets no refusal name a pack beyond those.
- **The card's step 3 names one list, and the bucket takes four.** They
are `PACKAGE_SCOPED_TYPES`, `PACKAGE_SCOPED_READ_TYPES`,
`PACKAGE_SLOTTED_METADATA_TYPES` and `NAMESPACE_UNIQUE_TYPES`. The
service's one copy per name is governed by the third, not the first.
`skill` is in the first three; its one-holder rule inside a namespace is
phase 1's, which a new type never had.
- **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.
- **Shallow checkout.** No claim here is read from history dates.
- **Noted, not filed.** On `main` the several-packs answer lists pack
names only (`packages/services/service-record-context/src/sentences.ts`,
`severalPacks`). ADR-0160 D4, as amended on 2026-11-25, says each
candidate is listed by name with its `label`. This is read from source,
not measured through the tool, and no first-party object has several
packs. The addendum leaves what that answer carries to D4.
## Verification
**Read first**, by risk:
1. `docs/adr/0150-…-literal-prefix.md`, "Past the card's words" at the
end of the addendum: the two decisions that are the maintainer's.
2. The same file, the D1 table hunk: one row inserted into a ruled
table. Check that it reads as an addition and changes no ruled row.
3. The same file, the status line: the appended clause.
**Two-minute check**: run `node scripts/check-adr-symbol-anchors.mjs`.
Expect `4186 anchors across 163 records resolve` and exit 0. Fourteen of
them are this diff's `path#Symbol` anchors.
<details>
<summary>Measured anchors on main at 0a1b69c (file:line)</summary>
| What the addendum says | Where it is read |
|---|---|
| The type is on `main`, and a pack name holds no hyphen |
`packages/spec/src/ai/ai-context.zod.ts:136` (`AiContextSchema`),
`:157`; `packages/spec/src/kernel/address-grammar.ts:68`
(`ROUTER_ADDRESSABLE_NAME_PATTERN`) |
| Pack selection keeps the packs rooted on the object and matches a bare
name | `packages/services/service-record-context/src/read-set.ts:65`
(`selectContextPack`) |
| Two packs of one name on one root: `409`; with another name and no
`context`: the several-packs answer |
`packages/services/service-record-context/src/record-context-tools.ts:266`,
`:265` |
| The one rule resolves only its listed types |
`packages/core/src/package-scoped-resolution.ts:245`
(`PACKAGE_SCOPED_TYPES`; `skill` at `:270`) |
| It throws for a type outside the list |
`packages/core/src/package-scoped-resolution.ts:740`,
`packages/objectql/src/package-scoped-resolver.ts:148` |
| 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`), read by
`packages/objectql/src/registry-package-addressing.ts:433` |
| 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`),
`packages/metadata/src/package-slotted-store.ts:154` |
| Any other type is keyed by name alone |
`packages/metadata/src/package-slotted-store.ts:797` (`storeWriteKey`),
`:820` |
| The last registration replaces the copy |
`packages/metadata/src/metadata-manager.ts:1499`,
`packages/metadata-protocol/src/protocol-registry-hydration.ts:148` |
| One package holder of a name inside a namespace |
`packages/objectql/src/namespace-co-owner-names.ts:96`
(`NAMESPACE_UNIQUE_TYPES`); the list is reserved to the maintainer at
`:27` |
| The type opens no overlay channel, and its row is not among the served
overrides | `packages/spec/src/kernel/metadata-plugin.zod.ts:1388`,
`packages/metadata-protocol/src/protocol-package-bindings.ts:388`
(`SEALED_ROW_SERVED_OVERRIDE_TYPES`) |
| A skill prompt's name: a face, else a bare name by the one rule |
`packages/mcp/src/skill-prompts.ts:373` (`lookupSkillPrompt`) |
| The one face derivation | `packages/spec/src/ai/face-name.ts:86`
(`deriveAiFaceName`) |
| The owner stamp's judge, and the pack's collection among those it
judges | `packages/spec/src/kernel/collection-item-owner-stamp.ts:129`,
`:107` |
| 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`) |
| The one first-party declarer: two packs, two names, two roots |
`examples/app-showcase/objectstack.config.ts:223`,
`examples/app-showcase/src/ai/record-context.ai-context.ts:20`, `:30` |
Absence readings, each with a positive control:
- `ai_context` in the four list files and in
`packages/metadata/src/package-slotted-store.ts`: 0 lines each. Control:
`skill` is in the first three lists, at the lines the table gives.
- The skill key: `packages/spec/src/ai/skill.zod.ts` has 0 `context:`
property lines. Control: 1 `tools:` line.
- `objectstack-ai/hotcrm` at `b1ea6fcc`: `ai_context`, `aiContexts` or
`ai-context`, 0 files. Control: `skills:`, 6 files.
</details>
<details>
<summary>Local gates at head deee29a: 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 1222 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
0 node scripts/check-closing-keyword-parity.mjs --self-test
0 node scripts/check-comment-mask-corpus.mjs 23898 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
0 pnpm check:adr-index docs/adr/README.md is current, every record parsed
0 pnpm check:adr-symbol-anchors 4186 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, 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, so the index does not change and is
not in this diff.
</details>
<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufzi13yZRqVcp2mGonWK -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent c355f85 commit 6211ddf
2 files changed
Lines changed: 44 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| |||
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
105 | 146 | | |
106 | 147 | | |
107 | 148 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
| 96 | + | |
95 | 97 | | |
96 | 98 | | |
97 | 99 | | |
| |||
0 commit comments