Files
my-pi/pi-tool-search/CHANGELOG.md
T
云服务部-叶林立 dec48dab6d feat: 新增系统提示词封面,并修正工具结果投影与常驻工具
系统提示词封面(新增能力):

- extensions/system-prompt-cover.ts:读取 ~/.pi/agent/SYSTEM_COVER.md,
  在 before_agent_start 返回 { systemPrompt },用文本拼接替换 Pi 默认
  系统提示词的开头,同时保留 tools / rules / docs / skills /
  project_context / cwd 全部分区及其原始顺序。
- 必须走 forceSystemPrompt 投影路径。customPrompt 选项会连带抑制
  tools / rules / docs 三个分区,而回填只能追加到末尾,无法恢复原顺序;
  且 forceSystemPrompt 优先级更高,二者同时存在时 customPrompt 会被
  静默忽略,因此 handler 不得写 customPrompt。
- 分割边界要求独占一行的裸标签:<project_instructions path="..."> 嵌套在
  <project_context> 内,只有裸标签才是分区边界。
- 注册在 tool-routing 之前,否则提示词已被压平,改 systemPromptOptions
  不再影响本轮请求。
- scripts/deploy-system-prompt-cover.mjs:同目录临时文件 + rename 原子
  覆盖,不保留备份;install.sh 从脚本目录、update.sh 从升级后组合包
  定位 helper,禁止回退到可能陈旧的脚本目录。
- 封面缺失、不可读或空白时静默 no-op,Pi 行为保持不变;封面每轮重新
  读取,修改后在下一轮生效,不影响已结束的历史对话。

pi-compaction 投影修正:

- 仅在「摘要 + Source 行」严格短于原文时才替换工具结果。此前命中即
  无条件替换,小结果反而被包壳放大;未替换的结果完整保留原始 content
  parts(含非文本部分)。
- deterministic.maxStubTokens 由 256 提升到 1024。

pi-tool-search 常驻工具:

- alwaysEnabled 增加 context_tree_query:恢复被投影的工具证据不应依赖
  一次 tool_search 激活,常驻同时保持请求前缀稳定。
- BUNDLE_TOOL_SEARCH_DEFAULTS_VERSION 由 3 提升到 4;
  scripts/migrate-tool-search-settings.mjs 新增 version-3 快照常量,
  使其与 version-2 一样可被完整精确匹配并迁移。
- 权限策略为 context_tree_query 显式 allow:它只读扩展自己的 segment
  索引、不触碰工作区,常驻后不应每轮触发 AutoReview 往返。该种子仅在
  全新安装时部署,已存在的用户 policy.jsonc 不会被覆盖。

文档与测试同步:

- AGENTS.md:新增 system-prompt-cover 开发约定,修正加载顺序、
  bundleDefaultsVersion、可迁移旧快照集合与常驻工具范围的描述。
- pi-tool-search 的 README / CHANGELOG 同步 version 4 与新增常驻工具。
- tests/system-prompt-cover.test.ts:覆盖顺序保持、尾部逐字节不变、
  嵌套 project_instructions 不误判、部署幂等与覆盖、缺源时非零退出。
- 修正 pi-tool-search/test/config.test.ts 与
  tests/tool-search-settings-migration.test.ts 中写死的 version 3 与
  工具列表断言。
- update-git-clean-recovery / tool-search-settings-migration 的 mock
  组合包补拷 scripts/,与真实发布包结构一致,避免 helper 定位失败。

测试:根 61/61、pi-compaction 36/36 + tsc、pi-tool-search 16/16 + tsc、
pi-permission-system 2577/2577;sh -n 与 git diff --check 通过。
2026-10-15 18:02:03 -07:00

6.6 KiB

Changelog

Unreleased — my-pi maintained source

Changed

  • Imported upstream v0.3.6 at ddfb23646fd3957b791214de278e23aa393c9b13 for direct local maintenance.
  • Migrated runtime imports to @earendil-works/pi-coding-agent and current typebox.
  • Replaced the hidden steer/retry compatibility loop with current Pi dynamic-tool propagation.
  • Replaced the truncated name manifest and add-only lifetime with validated model-generated Tool Cards, workflow groups, and bounded LRU activation.
  • Added deterministic no-model fallback grouping, private manifest-hash caching, exact group overrides, lazy /tool-search-rebuild, and nested model usage accounting.
  • Added limits for active groups, generated group size, and total dynamic tools, plus current-host catalog/config/LRU tests.
  • Added checked-in authoritative groups for every tool exposed by the standard my-pi bundle, eliminating first-use model generation and user caching unless unrecognized third-party tools are present.
  • Replaced the Hermes and third-party Hippo assignments with the five tools exposed by the official Hippo Pi extension, grouped into recall and management workflows.
  • Replaced the retired Hippo hippo_* assignments with the vendored Hermes memory extension's six tools, grouped into memory-recall (memory_search, session_search, context_tree_query) and memory-management (memory_add, memory_replace, memory_remove, skill_manage).
  • Added the enabled bundle's Agent, get_subagent_result, and steer_subagent tools to a checked-in subagents orchestration group.
  • Added authoritative ssh-connection, ssh-remote-files, ssh-remote-search, and ssh-remote-shell groups for the maintained pi-ssh tools, keeping reviewed connection, bounded discovery, structured file operations, and reviewed shell execution separate; the connection workflow now requires sequential ssh_connect to succeed before dependent tools.
  • Added sequential ssh_cd to the authoritative remote-shell workflow and direct the model to wait for a successful workspace change before dependent remote calls, avoiding both the unknown-tools fallback and cwd races.
  • Added the authoritative user-interaction group for the maintained ask_user_question TUI tool.
  • Added authoritative chrome-navigation, chrome-interaction, and chrome-debugging groups for all 21 tools registered by the pinned pi-chrome bridge after explicit session authorization.
  • Raised the bundle defaults to five active groups and 28 dynamic tools, and pinned the high-frequency Context Mode execution trio alongside CodeGraph exploration and LSP diagnostics.
  • Pinned all six Hermes memory tools in the bundle defaults and raised bundleDefaultsVersion to 3. The injected memory policy expects these schemas every turn, and pinning also keeps the request prefix cache-stable instead of paying a tool_search round trip plus a cache invalidation. scripts/migrate-tool-search-settings.mjs migrates the complete version-2 snapshot with an owner-only backup, atomic replacement, and fail-safe preservation of custom or invalid settings.
  • Pinned context_tree_query alongside the memory tools and raised bundleDefaultsVersion to 4. Recovering pruned tool evidence must not depend on a tool_search activation, and the added name keeps the request prefix stable. The migration helper now accepts the complete version-3 snapshot in addition to version 2.
  • Added atomic multi-group activation through tool_search.groups, bounded to five exact group ids and rejected without state changes when the complete workflow cannot fit.
  • Weighted exact tool names, group metadata, and common SSH/Chrome/Context aliases during query routing; weak or ambiguous matches now return candidates instead of activating arbitrarily.
  • Added /tool-search-status for catalog source, capacity, active-group LRU order, and latest eviction diagnostics.
  • Added an explicit update.sh migration for the complete former 3/20 bundle-default snapshot, with owner-only backup, atomic replacement, provenance versioning, and fail-safe preservation of custom or invalid user settings.

Fixed

  • Treat Pi's optional powershell definition as the same pinned local-shell/core class as bash on Windows, while excluding it from non-Windows catalogs so it cannot become an unknown-tool model group.
  • Activate exact existing groups from the current catalog before optional unknown-tool model enrichment, preventing unrelated catalog generation from delaying known group loads.
  • Include pinned tools in the optional footer's total-tool denominator.

[0.3.6] - 2026-04-24

Bug Fixes

  • Clear footer status when toolSearch.showToolSearchFooterStatus is false, and re-read setting each refresh so settings changes take effect without stale status.
  • Add explicit showToolSearchFooterStatus config name with backward compatibility for older status keys.

[0.3.5] - 2026-04-23

Other

  • Add pi install npm:pi-tool-search command to README

[0.3.4] - 2026-04-23

Other

  • Clarify core defaults and token-saving purpose

[0.3.3] - 2026-04-23

Bug Fixes

  • Refresh active tools on every turn_start, not only fresh user prompts, so unlocked tools stay available during agent-loop continuations
  • Queue hidden steer hint after successful tool_search so agent can continue/retry without waiting for another user message
  • Stop showing visible retry guidance in tool_search results and narrow hidden retry hint so successful same-turn tool calls are not repeated

Other

  • Document same-response activation caveat and recovery behavior in README.md

[0.3.2] - 2026-04-23

Bug Fixes

  • Split tool_search description into "Already active" and "Hidden" sections so LLM skips redundant enable calls
  • Add grep and find to default core tools (always enabled alongside read, write, edit, bash)

[0.3.1] - 2026-04-23

Other

  • Add repository field to package.json

0.3.0

  • Renamed from pi-lazy-tools to pi-tool-search
  • Config key changed: lazyTools → toolSearch in settings.json
  • showStatus config option: show/hide N / total tools footer status (default: on)
  • Provider-agnostic: removed payload-level filtering, relies solely on setActiveTools
  • readUserConfig() consolidates all settings reads into one call

0.2.0

  • User config: add "toolSearch": { "alwaysEnabled": ["lsp", "grep"] } to settings.json to pre-unlock tools beyond the defaults
  • Reads config at each session_start — no reinstall needed after changes

0.1.0

  • Initial release
  • Manifest-aware tool_search gate
  • names: string[] batch enabling
  • Per-turn manifest refresh via before_agent_start