Generate skill tool schemas in SkillFrontmatterField.fromFrontmatter#5482
Merged
jurgenwerk merged 2 commits intoJul 14, 2026
Conversation
…tmatter
Review feedback on the index-time tool schema stamping asked whether the
schema work could live in SkillFrontmatterField.fromFrontmatter instead of a
skill-shape-aware stamping pass inside the generic host file extractor. It
can: fromFrontmatter is now async and receives a context ({ fileURL,
toolContext? }); the skill subclass generates tool definitions itself (via
import.meta.loader, direct card-api import, and basicMappings), and hands
back a structured result. The enriched frontmatter (resource-only) and any
ToolSchemaErrors ride back to the extractor on the same out-of-band symbol
channels the frontmatter parse error uses, so schemas still never land in
search_doc.
The file-extract route now mints the owner-carrying ToolContext and threads
it through extractAttributes options; its presence is what gates the
module-loading schema work to the indexing path.
Also renames the stamped ToolField JsonField from `tool` to `definition`
per review, and adds a loader shim for @cardstack/runtime-common/helpers/ai
so base modules can value-import basicMappings.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Preview deploymentsHost Test Results 1 files ±0 1 suites ±0 2h 56m 15s ⏱️ -38s Results for commit 2efd971. ± Comparison against earlier commit 1b2f70c. Realm Server Test Results 1 files ±0 1 suites ±0 11m 20s ⏱️ -9s Results for commit 2efd971. ± Comparison against earlier commit 1b2f70c. |
Review feedback: naming toolSchemaErrors in FromFrontmatterResult leaked tool knowledge out of SkillFrontmatterField. The contract is now a kind-agnostic Partial<Diagnostics> bag — a FrontmatterField subclass contributes whatever diagnostics keys it owns, and the plumbing (markdown-file-def symbol channel, host extractor, extract response, file-indexer merge) carries it opaquely as frontmatterDiagnostics. Only SkillFrontmatterField (producer) and the /_indexing-errors surfacing (consumer) name the toolSchemaErrors key. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
jurgenwerk
approved these changes
Jul 14, 2026
49d0733
into
cs-12044-index-time-tool-schema-generation-for-skill-markdown-file
72 of 73 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restructures the index-time tool schema generation so the schema work lives in
SkillFrontmatterField.fromFrontmatter— the type that owns the skill frontmatter schema — instead of a skill-shape-aware stamping pass inside the generic host file extractor. Addresses the review feedback on the base PR; the observable behavior (stamped file-meta, clean search_doc,diagnostics.toolSchemaErrors) is unchanged.Shape
FrontmatterField.fromFrontmatteris now async and returns a structured result; the base implementation is unchanged in behavior. Only the skill subclass does tool work — the extractor no longer inspectskindor the tools array.FrontmatterFieldsubclass contributes aPartial<Diagnostics>bag, and the plumbing (markdown-file-def, the host extractor, the extract response'sfrontmatterDiagnostics, the file-indexer merge) carries it opaquely. OnlySkillFrontmatterField(producer) and the/_indexing-errorssurfacing (consumer) name thetoolSchemaErrorskey.extractAttributesto the extractor on the same out-of-band symbol channels the frontmatter parse error uses (FRONTMATTER_FILE_META_VALUE_SYMBOL,FRONTMATTER_DIAGNOSTICS_SYMBOL), so multi-KB definitions still never land insearch_doc.ToolContextand threads it throughextractAttributesoptions. Its presence is the gate: host-package tools resolve services through the context's owner at construction, and only the indexing path should pay the module-loading cost — interactive extract paths (room file attach, the store's direct fallback) pass none and skip the work. This replaces thegenerateToolSchemasboolean the base PR used.ToolField's stamped JsonField is renamedtool→definition(per review). Legacy Skill cards'commandsentries now serialize withdefinition: nullrather thantool: null.basicMappingsfrom@cardstack/runtime-common/helpers/ai, which needs a loader shim in the host's externals (same lazy pattern asmarked-sync)./_indexing-errors, boxel-cli formatter) are untouched.Testing
The existing acceptance coverage (
prerender-file-extract-test) exercises the full path — stamping via the render route, search-doc/authored split, broken-tool error attribution, non-skill kinds — and is updated only for the renamed surfaces. Type-check and lint pass across base, host, and runtime-common; host suite runs in CI.🤖 Generated with Claude Code