Skip to content

Skill catalog trigger-clause detection: generic verb branch can pick imperative prose over the real when-to-use sentence #4520

Closed

Description

@code-yeongyu

Summary

The one-line skill catalog added in #4456 keeps each description's when-to-use sentence when it cuts a long description. In packages/coding-agent/src/core/skills-prompt.ts, TRIGGER_CLAUSE (line 13) has a verb branch, (?:Use|Used|Read|Load|Invoke|Apply|Run|Call)\b[^.!?]{0,40}?\b(?:when|whenever|for|before|after|if|only)\b. It also matches ordinary imperative prose that is not a trigger, such as "Run the formatter for each package before tagging." Because the first match wins, a misfire picks that sentence as the clause, and the real "Use when ..." sentence after it can be cut.

Measured on real skill libraries (86 descriptions with a trigger clause), the branch misfired 0 times. This is a latent precision gap, not an observed regression.

Reproduction (synthetic description, >100 skills so the one-line form is used)

Description: Formats the release notes for every package in the monorepo, grouping entries by section and linking pull requests. Run the formatter for each package before tagging. Use when the user asks to draft or fix release notes.

Rendered line:

- notes [r0]: Formats the release notes for every package in the monorepo, grouping entries by section and linking pull… Run the formatter for each package before tagging.

The catalog keeps "Run the formatter for each package before tagging." as the trigger, and the actual "Use when the user asks to draft or fix release notes." is cut.

Expected

The clause picked is the description's real when-to-use sentence. Explicit trigger forms (Use when/for/whenever, MUST USE, USE ONLY WHEN, This skill should be used, Triggers:) should rank above the generic verb branch. For example, try the explicit forms first and fall back to the verb branch only when none match, or restrict the verb branch to when|whenever|before|after|if directly after a short object.

Acceptance criteria

  • A table-driven test with imperative-prose decoys (Run ... for ..., Load ... before ..., Call ... if ...) placed before a real Use when sentence, asserting the real sentence is the one kept.
  • Re-run the real-library survival measurement from feat(coding-agent): list a large skill catalog one line per skill #4456 and show it does not drop (39/65 and 62/89 at 160 characters).

Related

Activity

  1. code-yeongyu commented on Oct 29, 2026

    @code-yeongyu
    OwnerAuthor

    Fixed by #4567, merged as 46641be.

    Evidence at head 9338dd4:

    • Hosted CI green: 22 pass, 0 fail (Check and test included).
    • Merge-result typecheck on main b2bdaeb: OK (0 errors).
    • merge-gate dry run: MERGE_OK_DRY via exact-head, basis ci-green@9338dd43ce.
    • Merge-only delta review after merging main: CLEAR.
    • Regression test 4520-explicit-trigger-clause-first.test.ts: 7 of 8 rows fail on main, 8/8 pass with the fix; 3483-prompt-goldens.json unchanged.
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