Skip to content

Large skill catalog: list one line per skill (name, shortest location, 100-char line) and compact from 16 KiB of descriptions #4449

Closed

Description

@code-yeongyu

Summary

A large skill catalog (more than 100 skills or more than 64 KiB of descriptions) is already listed in compact mode, but each compact entry is still a five-line XML block with a full rN/<name>/SKILL.md location and a 160-character description cut mid-word. On a real 101-skill catalog that block is about 8,300 tokens (o200k estimate) on every request. The compact trigger also has a cliff: hiding a few skills (for example retired ones) drops a 98-skill catalog back to full multi-sentence descriptions, which is larger, not smaller.

Reproduction

  1. Load ~100 skills whose descriptions average ~300 characters (a typical personal skill library).
  2. Render the system prompt (formatSkillsForPrompt).
  3. Each entry is <skill>\n<name>..</name>\n<description>..</description>\n<location>rN/name/SKILL.md</location>\n</skill>; 100 of 101 locations are exactly rN/<name>/SKILL.md and carry no information beyond the root alias.
  4. Remove three skills (98 left, ~29 KiB of descriptions): the catalog falls below both thresholds and every full description is listed.

Measured (real 101-skill catalog, o200k estimate)

format tokens
current compact XML, 160-char descriptions 7,963 (+315 header)
one line per skill, location kept, 160 chars 5,439
one line, root alias when the path is <name>/SKILL.md, 160 chars 4,526
same, 100 chars cut at a word boundary 3,113

Expected (ideal state)

  • A large catalog lists one line per skill: - name [location]: one-line description, inside the same <available_skills> wrapper and after the same <skill_roots> table.
  • location is the root alias alone (r0) when the file is <root>/<name>/SKILL.md, else the path under the root (r1/bundle/SKILL-x.md), so every skill stays resolvable; one header line states the rule.
  • The one-line description is at most 100 characters, cut at a word boundary.
  • The compact trigger uses a 16 KiB description budget (count threshold unchanged), so a ~100-skill library stays compact when a few skills are hidden, while a default install with ~30 bundled skills keeps full descriptions.
  • The names-only fallback (over the 48 KiB cap) uses the same one-line form without descriptions.
  • Small catalogs are unchanged.

Actual

packages/coding-agent/src/core/skills-prompt.ts: renderSkills emits the XML block for compact entries; ONE_LINE_DESCRIPTION_MAX_CHARS = 160 cut without a word boundary; COMPACT_SKILL_CATALOG_DESCRIPTION_BYTES = 64 KiB.

Acceptance criteria

  • Regression test: a 98-skill catalog with ~300-character descriptions is compact; every line is - name [location]: …, at most 140 characters; every location resolves to the skill's file through the roots table.
  • Existing small-catalog and names-only bounds tests still hold (updated for the line form).
  • Real first-request measurement before/after (input total and cacheRead) in the PR.

Related

Activity

  1. code-yeongyu commented on Oct 27, 2026

    @code-yeongyu
    OwnerAuthor

    Correction: the "cliff" in the summary does not hold for a ~100-skill library like the one measured. With 98 skills (32 KiB of descriptions) the catalog stays compact, because its full render exceeds the existing 48 KiB cap (MAX_SKILL_CATALOG_BYTES). The 16 KiB trigger matters for catalogs whose full render fits under 48 KiB. Real-session numbers are on #4456.

  2. code-yeongyu commented on Oct 28, 2026

    @code-yeongyu
    OwnerAuthor

    Fixed by #4456, merged into main as 4179b9d.

    Evidence:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions