Skip to content

feat: an app's ask skill text is capped at 8,000 characters at build, at save and in Studio - #39246

Draft
objectstack-fleet[bot] wants to merge 13 commits into
mainfrom
claude/issue-39102-app-skill-text-cap
Draft

objectstack-fleet[bot] wants to merge 13 commits into
mainfrom
claude/issue-39102-app-skill-text-cap

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #39102

Clause-②: yes (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up owed — skills/objectstack-ai/SKILL.md (its skill section teaches surface and the ask agent's skills; it should state the 8,000-character app cap and what counts) and skills/objectstack-ai/evals/skills-tools-knowledge.json (no case exercises an app over the cap)

维护者速读

  • 用户能看到什么变化:应用的问数技能合计超过 8,000 字时,项目校验或构建直接报错、在界面或接口保存技能时拒绝保存,都写明合计长度和上限;Studio 的 AI 技能页按应用显示「合计 / 8,000」,超了标红。
  • 为什么做:落实云端问数技能上限那张卡的第 2、3 项(构建期、保存期和界面三处),让四个读者用同一个口径数字数。
  • 出错会怎样:已经超限的应用会在构建和保存加字时被拒,作者需要删减技能文字;减字的保存始终放行,可以逐条改回上限之内,合并后可直接撤回。
  • 要你做什么:无。

What changes

The hosted ask agent caps the skill text one app (package) binds on the ask surface (cloud ADR-0118 D5; cloud's PACKAGE_SKILL_TEXT_CAP = 8_000). This PR declares the cap and its one measure in the spec and holds it at the three open-framework doors the card names.

  • spec (packages/spec/src/ai/package-skill-text.ts, exported from @objectstack/spec/ai): PACKAGE_SKILL_TEXT_CAP (8,000), composeSkillSection (the section cloud's SkillRegistry.composeSkillSection builds: the heading line \n### {label} ({name}), description, instructions, Tools: {tools joined by ", "}, joined with newlines, an absent or empty line left out), countsTowardPackageSkillText (surface ask, both, or unset — the schema default is ask; build never counts), packageSkillTextLength, packageSkillTextTotal, formatPackageSkillTextCount and packageSkillTextCapMessage (the one sentence every door refuses with: the app, its total, the cap, 8,520 / 8,000, and the ways out). A test pins the composed string for a fixture skill, so a drift against cloud's copy shows as a diff of that literal.
  • os validate / os build (packages/cli/src/utils/app-skill-text-cap.ts, one stanza each in validate.ts and compile.ts beside the namespace-name refusal): an app over the cap fails the command; --json carries one errors[] row per app (packageId, total, cap, message), and os build writes no artifact. An artifact's packages[] bodies are one app each; the stack's own top-level skills are the stack's app under its manifest.id.
  • Metadata save door (packages/metadata-protocol/src/protocol-skill-text-cap.ts, one call in protocol-save.ts): a skill save after which the app it lands in is over the cap AND higher than before is refused 422 INVALID_METADATA (an existing published code — no ledger change), its message and its one issues[] entry naming the app's total and the cap. The app is the package the save LANDS IN — the same landing binding the permission-set name refusal judges against (the request's package, or for a draft naming none, the draft address's into). The set is that package's served skill list, with pending drafts shown for a draft save. Every writer reaches it: Studio, PUT /api/v1/meta/skill/NAME, an MCP draft save.
  • Studio → AI → Skills (ui/packages/app-shell/src/views/metadata-admin/SkillTextCapTotals.tsx, one line in ResourceListPage.tsx, two strings each in the studio en/zh packs): each app's total against the cap above the list, e.g. com.acme.crm — ask skill text 8,520 / 8,000 (zh: 问数技能合计 8,520 / 8,000 字), in the destructive (red) tone with a tooltip when over.
  • ADR-0087 ledger entry app-skill-text-over-cap-refused (relevance: the stack declares skills), the changeset's registered disposition for the narrowing.
  • Docs: content/docs/ai/agents.mdx gains "An app's ask skills share an 8,000-character cap".

Which tools are measured, and why. Cloud measures a skill after narrowing its tools to the ask allow-set; build and save time see the DECLARED tools. These doors measure the declared list, so their Tools: line is never shorter than the runtime's and their total is never lower: an app these doors accept, the runtime accepts too. The bound is stated in the spec module's header.

Landing points beyond the claim's file surface, with reasons. packages/cli/src/utils/ (the check's module; commands/ is oclif's command directory, and every sibling refusal of this kind lives in utils/); ui/packages/i18n/src/namespaces/studio/{en,zh}.ts (Studio strings live only there); packages/spec/src/migrations/** (a declared narrowing owes a registered ADR-0087 entry — check:adr-0087-registration refuses no-migration-prescription on Metadata-protocol: narrowed); scripts/engine-double-contract.pinned.json (the new save-door test's pinned engine double, written by the gate's own --write).

Why

objectstack-ai/cloud#5361 items 2 and 3, verbatim: 「os validate 或构建直接报错,写明长度和上限」; 「在界面或接口保存技能时拒绝保存,同样写明长度和上限」; 「在 Studio → AI → Skills 页,显示每个应用问数技能的合计长度和上限(例如「8,520 / 8,000 字」),超了标红」. The runtime arm (load every skill, never drop one) landed in cloud and is not in this PR.

Tests

  • packages/spec/src/ai/package-skill-text.test.ts — the cap; the exact composed string; empty lines left out; ask/both/unset count, build does not; the sum; the sentence.
  • packages/cli/src/utils/app-skill-text-cap.test.ts — one-app refusal (8,520), exactly-at-cap and build controls, per-package judgement of an artifact.
  • packages/cli/test/validate-app-skill-text-cap.test.ts (integration) — the real CLI: os validate --json exits 1 with one row (8520, cap 8000, (8,520 / 8,000) in the message), the text face names the total and the cap, os build --json exits 1 and writes no artifact, CONTROL at exactly 8,000 validates.
  • packages/metadata-protocol/src/protocol.skill-text-cap-save-door.test.ts — through the real saveMetaItem over a store-and-registry double: publish and draft mode refused INVALID_METADATA/422 naming 8,520 / 8,000 with nothing stored; CONTROLs at exactly the cap; an edit counts the new body; a build skill and another app's skills do not count; a build→both switch that tips the app over is refused; an app already over the cap can be lowered and cannot be raised.
  • ui/.../SkillTextCapTotals.test.tsx — per-app sums with the spec measure, 8,520 / 8,000 marked over and red, 4,000 / 8,000 not, the zh string, nothing drawn without an app.
  • Ablation (save door): with the door's throw disabled, 5 of the 9 save-door cases go red (both refusal modes, the edit, the surface switch, the over-cap raise) and the 4 controls stay green; restored from the commit.

Acceptance notes

  • Other save paths (card: not measured before). Through the door already: duplicatePackage, importUnmanagedPackage, the move into a package and migrateStoredMetadata all call saveMetaItem. Not judged here: draft promotion (publishMetaItem / publishPackageDrafts) — a draft is judged at its save against the package's set with drafts shown, but the promotion does not re-judge, so an active save of a sibling between the two can leave the published set over; rollbackMetaItem / revertCommit restore an older body without this door; a package install of an artifact (installPackage) is judged at os build, not at install. Each leaves the runtime's own arm (cloud loads every skill) as the backstop.
  • "would put its app over" read as: over after the save AND higher than before. A strict "over after the save" reading would block the edits that bring an over-cap app back down; this reading lets an app be trimmed one skill at a time. Recorded as a settled trade-off for the seat.
  • A skill bound to no package belongs to no app and is not judged at any door; Studio sums only rows carrying _packageId.
  • The CLI row carries no code: stamping INVALID_METADATA from @objectstack/cli would need a new provenance row in the error-code ledger, a contract edit not asked for here.
  • The measure reproduces cloud's composeSkillSection from the description read at cloud 44a7c80 (this session could not attach the cloud repository); the pinned literal is the check for drift once cloud reads the spec export.

Verification

Two-minute check: pnpm --filter @objectstack/metadata-protocol exec vitest run --maxWorkers=2 src/protocol.skill-text-cap-save-door.test.ts — expect Tests 9 passed (9).

Read first (by risk): packages/metadata-protocol/src/protocol-save.ts (the permission/capability landing block now also serves skill), packages/metadata-protocol/src/protocol-skill-text-cap.ts, packages/spec/src/ai/package-skill-text.ts.

Local runs (union at c219001/fd66e398; scoped re-checks on the merge head 5873293)
  • pnpm --filter @objectstack/metadata-protocol exec vitest run --maxWorkers=2 — 384 files passed, 9 skipped; 23,959 tests passed.
  • pnpm --filter @objectstack/spec --filter @objectstack/cli --filter @objectstack/metadata-protocol typecheck — exit 0.
  • @objectstack/spec src/ai + src/migrations — 32 files, 853 tests passed (merge head). The full spec suite and the cli unit project exceed the container's foreground cap: NOT MEASURED, CI.
  • New cli files — 8 passed (merge head); UI SkillTextCapTotals + studio-namespace parity — 22 passed (merge head).
  • pnpm --filter @objectstack/spec check:generated — all 14 artifacts up to date (merge head).
  • dispatch-gates --ran — 135 derived families: 128 run, every one exit 0; 7 NOT MEASURED: pnpm --dir ui exec vitest run scripts/ and check:query-options-erasure (over the foreground budget), check-plugin-teardown-shape --self-test (shallow clone), check:dual-build-cjs-loads, check:i18n, check:i18n-coverage, check:i18n-walk-parity (PREREQUISITE NOT MET: builds outside this diff). Re-run on the merge head: check:adr-0087-registration, check:engine-double-contract, check:test-source-alias.
  • UI typecheck: NOT MEASURED locally (the @object-ui/* dependencies are unbuilt here); the new component has no diagnostics of its own in that run. Type Check UI in CI.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (The new module is a constant and a pure measure, as face-name.ts beside it.)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes. (No formatter ran; pnpm lint is the CI run's, not run locally.)
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

Generated by Claude Code

claude added 12 commits December 3, 2026 00:32
…text cap exports

Claude-Session: https://claude.ai/code/session_012dn2AcUDbrgRnUrYc6fcNr
Co-authored-by: Claude <noreply@anthropic.com>
… its app over the skill text cap

Claude-Session: https://claude.ai/code/session_012dn2AcUDbrgRnUrYc6fcNr
Co-authored-by: Claude <noreply@anthropic.com>
… text cap save-door test

Claude-Session: https://claude.ai/code/session_012dn2AcUDbrgRnUrYc6fcNr
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation protocol:ai tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/cli, @objectstack/metadata-protocol, @objectstack/spec, touching 30 documentable anchor(s). ⚠️ 3 changed file(s) yielded no anchor (packages/spec/api-surface/ai.json, packages/spec/export-origins/ai.json, packages/spec/src/ai/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

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

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

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

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

Which tree this was computed on

This run read content/docs from 9fc3742979eb0ba22425f0458942af5f3b3f1ea8 — the merge of head 3420498aa3432c004abf4ec3c92927f92edb6e39 into base 1fe9c6287f2f058c7d1f1972cdfa4ebcd58803b6, which is what actions/checkout gives a pull_request run. Not the PR head.

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

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 9fc3742979eb0ba22425f0458942af5f3b3f1ea8 && git checkout 9fc3742979eb0ba22425f0458942af5f3b3f1ea8
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 1fe9c6287f2f058c7d1f1972cdfa4ebcd58803b6 3420498aa3432c004abf4ec3c92927f92edb6e39 && git checkout -B drift-repro 1fe9c6287f2f058c7d1f1972cdfa4ebcd58803b6 && git merge --no-ff 3420498aa3432c004abf4ec3c92927f92edb6e39

node scripts/docs-audit/affected-docs.mjs --json 1fe9c6287f2f058c7d1f1972cdfa4ebcd58803b6

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

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

…its BREAKING banner

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

App skills on ask: declare the 8,000-character cap in spec; os validate and the metadata write door refuse an app over it; Studio shows each app's total

2 participants