Q18: every skill, the first included, must fit the skill budget

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-08 04:42:06 -04:00
1 parent f4d16eb46a
commit d79fd87077
2 files changed
+20 -1

No files matched your search

+1 -1
View File
@@ -284,7 +284,7 @@ export class SkillService {
readFileSync(row.object_key, "utf8").trim(),
].join("\n\n");
const partTokens = estimateTokens(part);
if (compiledParts.length > 0 && compiledTokens + partTokens > input.maxTokens) {
if (compiledTokens + partTokens > input.maxTokens) {
omitted.push(manifest.name);
continue;
}
+19
View File
@@ -247,4 +247,23 @@ describe("built-in skills", () => {
expect(parseFrontmatter(HUMANIZER_MD).description).toContain("sound more natural and human-written");
expect(parseFrontmatter("no frontmatter")).toEqual({});
});
test("no skill, not even the first forced one, may exceed the skill budget", () => {
const h = harness();
const staged = stageBuiltinSkillsLibrary(h.sourceRoot, h.libraryRoot);
h.connection.transaction(() => importStagedSkills(h.skills, h.orgId, staged));
let agentId = "";
h.connection.transaction(() => {
agentId = h.organization.createAgent({
orgId: h.orgId, name: "Ada", role: "Engineer", department: "Engineering",
modelProviderId: null, modelId: null, budgetCents: 1000, managerAgentId: null,
});
});
const snapshotId = h.connection.transaction(() => h.skills.resolveRuntimeSnapshot({ orgId: h.orgId, agentId, runId: "run_tiny", maxTokens: 10 }));
const prompt = (h.connection.db.prepare("select compiled_prompt from skill_runtime_snapshots where id = ?").get(snapshotId) as { compiled_prompt: string }).compiled_prompt;
expect(prompt).not.toContain("# Skill:");
expect(prompt).toContain("# Skills omitted for size");
expect(prompt).toContain("humanizer");
h.connection.close();
});
});