Skip to content

feat(skills): support inline $ Skill references - #321

Closed
bkyssn wants to merge 1 commit into
openpi-dev:mainfrom
bkyssn:feat/issue-282-inline-skill-references
Closed

feat(skills): support inline $ Skill references#321
bkyssn wants to merge 1 commit into
openpi-dev:mainfrom
bkyssn:feat/issue-282-inline-skill-references

Conversation

@bkyssn

@bkyssn bkyssn commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Problem

Closes #282
Closes #316
Closes #317

Pi 的 Skill 补全只能通过消息开头的 /skill:name 使用,无法在提示词中间自然引用 Skill。

Value

用户可以在提示词任意位置输入 $,从当前已加载的 Skills 中选择,并用 Tab 补全而不发送消息。提交后模型会获得对应 Skill 内容,用户原始消息保持不变。

Approach

  • 在现有 TUI 补全器上增加 $skill-name 补全,候选始终来自 pi.getCommands(),不重复维护 Skill 清单。
  • before_agent_start 中把已知引用展开为隐藏的模型上下文,并保持原始用户消息不变。
  • 未知、转义、重复和标点相邻引用均有明确处理;原有 /skill:name、slash command 和 @path 行为保持不变。

Validation

  • bun run check:通过。
  • bun run test:1089 个 Node 测试通过,1 个既有测试跳过;30 个 Vitest 测试通过。
  • 人工 TUI 验证:输入 $ 能显示已加载 Skill,Tab 只补全不提交,提交后对应 Skill 可以正常使用。

Impact

  • 新增 TUI 内联 $skill-name 补全与展开。
  • 不新增配置、工具、缓存或持久化状态。
  • 保持现有 /skill:name@path 兼容。

@tt-a1i

tt-a1i commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

感谢 @bkyssn@sowen1023 的投入。这里由维护者统一整合:以 #322 的 Session 实现为基础,纳入 #321 的 TUI 补全和相关测试,并修复评审发现的队列、压缩与解析边界问题。整合、冲突处理和验证由我们负责,采用的代码会保留原作者贡献与共同署名。请先不用继续重复修改这两块;我们会在整合结果通过验证后合并主 PR,再将另一 PR 标明已整合并关闭。当前尚未合并。

tt-a1i added a commit to sowen1023/openpi that referenced this pull request Aug 31, 2026
…ections

Integrate the autocomplete adapter and Editor tests from bkyssn/openpi PR openpi-dev#321 into sowen1023/openpi PR openpi-dev#322. Preserve run-scoped Skill snapshots through native compaction and repair Unicode and autocomplete composition boundaries.

Co-authored-by: lwc <1803086257@qq.com>
tt-a1i added a commit that referenced this pull request Aug 31, 2026
* feat(skills): expand inline skill references

* fix(skills): expand queued inline references

* fix(skills): isolate inline skill projections

* docs: use a public inline Skill example

* feat(skills): integrate inline completion and preserve compacted projections

Integrate the autocomplete adapter and Editor tests from bkyssn/openpi PR #321 into sowen1023/openpi PR #322. Preserve run-scoped Skill snapshots through native compaction and repair Unicode and autocomplete composition boundaries.

Co-authored-by: lwc <1803086257@qq.com>

* refactor(skills): defer loading and lifecycle to native Pi

---------

Co-authored-by: tt-a1i <tt-a1i@users.noreply.github.com>
Co-authored-by: lwc <1803086257@qq.com>
agnitum2009 pushed a commit to agnitum2009/openpi that referenced this pull request Sep 3, 2026
…i-dev#322)

* feat(skills): expand inline skill references

* fix(skills): expand queued inline references

* fix(skills): isolate inline skill projections

* docs: use a public inline Skill example

* feat(skills): integrate inline completion and preserve compacted projections

Integrate the autocomplete adapter and Editor tests from bkyssn/openpi PR openpi-dev#321 into sowen1023/openpi PR openpi-dev#322. Preserve run-scoped Skill snapshots through native compaction and repair Unicode and autocomplete composition boundaries.

Co-authored-by: lwc <1803086257@qq.com>

* refactor(skills): defer loading and lifecycle to native Pi

---------

Co-authored-by: tt-a1i <tt-a1i@users.noreply.github.com>
Co-authored-by: lwc <1803086257@qq.com>

@tt-a1i tt-a1i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请等 #322,不要单独合

补全走 pi.getCommands(),展开是 before_agent_start 隐藏消息,用户文本不动,ENOENT fail-closed — 这些是对的。

过不了 compaction(正文会丢)。disableModelInvocation 没用上,被标记的 Skill 仍会注入。Maintainer 已经在往 #322 的集成 PR 收。

请不要把这份 146 行的版本单独合进去。

@tt-a1i

tt-a1i commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

更正刚才的评:#322 已在 8/31 合入,不该再写「等 #322」。

仍然不要单独合这份 146 行版本:正文过不了 compaction,disableModelInvocation 也没用上。请等 maintainer 的集成,而不是再等一个已经 merge 的测试 PR。

@tt-a1i tt-a1i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exact-head review: 18e5509

[P1] This reintroduces the Skill lifecycle that accepted Decision 0002 explicitly retired. extensions/inline-skill-references/index.ts adds a separate dollar-reference parser, TUI autocomplete contract, filesystem body read, and hidden model-visible injection. Decision 0002 lines 22-26 says Pi owns Skill loading/completion and specifically prohibits retaining a separate dollar-skill parser or autocomplete adapter. Merging this would create a second invocation and body-loading contract alongside the Pi-native path already adopted through PR #322.

Please close or supersede this PR unless the maintainers first amend/supersede Decision 0002 through the governed decision process. If the product direction changes, align the issue/spec and add lifecycle tests for persistence, queued input, compaction, and trust before implementation review.

Verification boundary: static Standards + Spec review against current main and the exact PR head; CI is green, but CI does not resolve the accepted-design conflict.

@bkyssn

bkyssn commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

收到。根据已合并的 #322 和当前 Decision 0002 的项目方向,这份 PR 不再继续单独合并。我现在关闭 #321,避免重复实现。感谢评审和整合;如果后续 Decision 发生变化,再基于新的 Issue 和规范重新提案。

@bkyssn bkyssn closed this Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants