feat: collapse expanded skill blocks in user messages - #354
Open
wuxiangru915 wants to merge 1 commit into
Open
Conversation
Sending /skill:name expands the whole SKILL.md into the user message via the pi agent core, which floods the chat with verbose instructions. Render each <skill>...</skill> block as a collapsible header (name, location, line count) that defaults to collapsed, with the full content available on click. Non-skill text around the blocks is preserved.
wuxiangru915
force-pushed
the
feat/collapse-skill-blocks-in-messages
branch
from
August 2, 2026 10:22
ceecb98 to
907db9e
Compare
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.
Summary
pi's agent core expands
/skill:namecommands by inlining the entire SKILL.md into the user message (<skill name="..." location="...">...full content...</skill>). In the web UI that floods the conversation with verbose skill instructions every time a skill is invoked.This PR renders each expanded
<skill>block in user messages as a collapsible header that defaults to collapsed — showing justskill: <name>, the SKILL.md location, and the line count — with the full content available on click.Behavior
▸ skill: name /path/to/SKILL.md 177 行 · 展开).Implementation
lib/skill-block.ts(new):splitSkillBlocks(text)splits a message into<skill>blocks and plain text segments (name/location parsed from attributes, order-independent). Unit-tested inlib/skill-block.test.mjs.components/MessageView.tsx:UserMessageViewrenders skill segments via a newSkillBlockcollapsible component; non-skill segments keep the existingMarkdownBodyrendering.chat.lines(en/zh) and reuses existingi18n.expand/i18n.collapse.Verification
lib/skill-block.test.mjs(7) +components/MessageView.test.mjs(3 new SSR render tests) + i18n registry — all passing.tsc --noEmit,eslint, productionnext buildall clean.