Repository navigation
feat(#433): wire acp_rule record tool behind opt-in rules config - #490
Conversation
📦 Built Extension ArtifactBranch: Option A — Install from npm PR tag (recommended)pi install npm:billion-context-pi@pr-490Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pi-pr490.tgz
pi install ./packageThis comment is automatically updated on each push. |
[bot] 🏷 Picking up this PR now — pulling branch |
[bot] 🏷 Verified PR #490 ( Code review — all claims hold:
Verification run on branch head:
On the three "Notes" findings: already properly documented in the PR body (lockfile root-version lag, kernel This is a feat (new tool surface), so per §7.4 it stays a human merge either way — nothing here blocks it. 结论:核对并复跑通过——acp_rule 工具按 #433 最终范围实现(opt-in、零系统提示词、硬保护、校验错误原样返回),代码与描述逐条相符,typecheck/构建干净、新增 8 个测试全过、CI 三条流水线全绿(本地 82 个失败均为沙箱 /tmp 只读的环境问题,与 master 一致),可以合并。 |
Note from #537 work: the human When this model-side |
c8aa2ce to
50060e7
Compare
Plain record tool per issue scope: single optional 'rule' argument — value records a short reminder (echoes 'Recorded ruleN: …'), omitted argument lists recorded rules for humans. No remove/clear, no action enum, zero system-prompt involvement (no promptSnippet/promptGuidelines; usage guidance lives in the tool description only). Rules persist in the .acp.json sidecar (state pipeline already on master via deriveChildState/ mergeInitialState) and are hard-protected from compression by the kernel's ALWAYS_PROTECTED_TOOLS. Off by default: 'rules': true in acp.json registers it at session start, after user-config reload. Adds 8 tests (registration gating, no-prompt-surface regression guard, record/list round-trip, verbatim validation errors incl. 50-rule limit, restart persistence, compression-protection fixture placed between the kernel's first-user pin and recent zone so survival proves protection) and documents the key in CONFIGURATION.md/.zh-CN.md, both READMEs, and the AGENTS.md module map.
50060e7 to
fa05715
Compare
|
补充关联:本 PR 也是 #539(rules 管道残缺)的修复 —— #539 报的正是 npm dist 里 acp_rule 工具注册缺失(仅剩 ALWAYS_PROTECTED_TOOLS 硬编码名),本 PR 接回完整管道: (另:分支已 rebase 到含 #533/#534/#543 的最新 master |
Mirrors the /acp-cache human-command pattern for the acp_rule feature (ranxianglei#490): bare /acp-rule lists all rules recorded in the current session, /acp-rule <text> records one via the same kernel API the model path uses (persisted in the session sidecar, injected next round). Output is transcript-only and stripped from model context via the same custom-type exclusion in entriesToCoreMessages; falls back to ui.notify on hosts without sendMessage. Ported from billion-context #1259 (issue #1251). Fixes ranxianglei#527
Closes #433
What
Completes the adapter side of #433 (state pipeline —
deriveChildState/mergeInitialStatecarryingrules/nextRuleId— already landed on master via 953d56a; kernel 0.0.81 ships the full rule surface). This PR wires the remaining surface:src/rule-tool.ts(new) —acp_rule, a plain record tool per the issue's final scope: one optionalruleargument. Value present → records via kerneladdRule, echoesRecorded ruleN: …. Argument omitted → lists recorded rules (formatRulesList) for humans. No remove/clear, no action enum.promptSnippet/promptGuidelineson the tool definition (pi renders those into the system prompt); all usage guidance lives in the tool description only; nothing re-injected per turn.acp_ruleis in the kernel'sALWAYS_PROTECTED_TOOLS, so its call+result survive any compress covering them — the reminder stays visible as a trace in the conversation.rules?: booleankey (src/user-config.tsKNOWN set +AdapterConfig), default off; registered at session start after user-config reload so project-localacp.jsonwins.resolveRuleLimits; validation errors (empty / over-length / duplicate / limit reached) are returned verbatim to the model.Tests
+8 tests (
tests/rule-tool.test.ts+tests/user-config.test.ts): registration gating (default off /rules: true), explicit assertion that the tool carries NO prompt-surface fields (regression guard for the zero-system-prompt constraint), record/list round-trips, verbatim validation errors incl. the 50-rule limit, restart persistence via the.acp.jsonsidecar, and a compression-protection test whose fixture places the acp_rule pair between the kernel's first-user pin and the last-5 recent zone so its survival can only come from protection, not recency.Full suite: typecheck clean, 788 pass / 82 fail / 6 skip — the 82 failures are pre-existing sandbox-only
/tmpEACCES artifacts of this environment (identical set on master before this change; CI is unaffected). Build clean.Notes (findings, not fixed here)
package-lock.jsonroot version lagspackage.json(0.1.73 vs 0.1.74);npm installre-syncs it locally, so this PR deliberately leaves the lockfile untouched to keep the diff pure.RULES_USAGE_PROMPTclaims rules are "re-injected into the system prompt every turn" — true for the billion-context proxy path, false for pi; the pi tool description therefore does not make that claim.No version bump, no acp-kernel pin change (0.0.81 already carries everything needed).