Repository navigation
feat: render prompts with a skill filter and expose skill plugin and source - #224
Merged
swedishborgie merged 2 commits intoOct 22, 2026
Merged
Conversation
…source - (ACAP-4332) Callers that deliver skills through an agent's native skill support had to cut the Skills section out of Result.Prompt by re-creating its text, which breaks whenever the prompt format changes. - RenderPrompt re-renders a prompt from an existing Result without running discovery again. WithSkillFilter leaves filtered skills out of the prompt while Result.Skills keeps the full list. With no options the output equals Result.Prompt. - Result.RuleSources carries the rule source paths the renderer needs. - skills.Skill gains Plugin (from the "plugin" frontmatter key) and SearchPath. Neither appears in the prompt XML. - WithSkillDiscovery discovers skills when bootstrap is off, so a caller can recompute skills per run without re-running rules or bootstrap scripts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adds tests for namespace skills, lenient name inference, lint mode and the skill cache keeping Plugin and SearchPath; for re-rendering a resume prompt discovered with WithSkillDiscovery back to task only; and for fenced rule content surviving RenderPrompt unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Why
Agents sometimes refuse the task when the prompt lists skills. In about 15% of runs, Cursor treated the
# Skillslist (skill names, descriptions andSKILL.mdpaths in the user turn) as a prompt injection and declined to continue. Agents trust skills that arrive through their own skill support, such as a plugin, so codegen-runner wants to deliver skills that way and leave them out of the prompt's# Skillslist.Today the only way to leave them out is to rebuild this library's Skills section text and cut it out of
Result.Prompt. That breaks silently whenever the prompt format changes. This PR lets the library do the rendering instead.What changed
RenderPrompt(r *Result, opts ...RenderOption) (string, error)re-renders a prompt from an existingResultwithout running discovery again.WithSkillFilter(keep func(skills.Skill) bool)leaves filtered skills out of the prompt.Result.Skillskeeps the full list.Result.Prompt.# Skillsis dropped when no skills remain.ErrRuleSourcesMismatchwhenRuleSourcesandRulesdon't line up.Result.RuleSourcescarries the rule source paths the renderer needs.skills.Skillgains two fields, both taggedxml:"-"so the prompt XML is unchanged:Plugin: the skill'spluginfrontmatter value.SearchPath: the local search path the skill was found under.WithSkillDiscovery(bool)discovers skills even when bootstrap is off. Rules and bootstrap scripts stay off, so a caller can recompute skills on every run.buildPromptnow calls a purerenderPrompt, soRun's output is byte-for-byte unchanged.Tests
TestRenderPrompt_NoOptionsMatchesRunTestRenderPrompt_SkillFilter: keep some; keep none with rules (matches the no-skills render byte for byte); keep none without rules (task-only output)TestRenderPrompt_RuleSourcesMismatchTestSkillDiscovery_PluginAndSearchPathTestWithSkillDiscoveryChecks run locally:
go test ./...passes.~/.agents/skills. It fails on a machine whose home folder has a skill with list-valued metadata, and passes with a cleanHOME.go vetanddeadcode -testare clean.golangci-lint run --new-from-rev=mainreports 0 issues.enumerate_test.go.taskparser/markdownparser.go:157.🤖 Generated with Claude Code