feat(agent): enable codemode in interactive sessions - #103
Merged
Merged
Conversation
Register pi's codemode tool with the Bkper built-ins and select it in the Bkper default tool lists, so the tool set stays stable across turns. Explicit defaultTools settings are kept. Describe codemode in the Bkper system prompt, which replaces pi's and so drops the tool's own snippet and guidelines. Book writes from scripts follow the single-command confirmation rule: resolve targets read-only, show the exact script and changes, run after confirmation, and return per-item results.
Pi resolves a defaultTools selection with only +name/-name entries in every settings layer against its own defaults, which lack codemode and PowerShell. A shared ~/.pi/agent setting such as ["+grep"] therefore dropped codemode, and on Windows replaced PowerShell with Bash. Read the raw global and project layers; when no layer lists plain tool names, apply their modifiers to the Bkper defaults instead. Shells added by a modifier still go through the unavailable-shell filter.
With the generic codemode guideline the model fanned out bkper commands with shell loops and jq instead. Name those alternatives in a shorter guideline, and shorten the Book write confirmation guideline without dropping a step. Drop the test that matched the guideline wording; the tool listing and the codemode-off case stay covered.
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.
User impact
The Bkper agent can now run several tool calls in one JavaScript script (codemode). Repeated bkper commands across books or items, chained commands, and large outputs are handled in one step, and only the script's result reaches the conversation.
Book writes from a script follow the same rule as single commands: the agent resolves the targets read-only, shows the exact script and every change, and runs it only after the user confirms.
Changes
defaultToolssettings that contain only+name/-nameentries now apply to the Bkper defaults instead of pi's, which lack codemode and PowerShell. Plain tool lists are kept as configured.Verification
bun run buildandbun run test:unitpass.bkperreads matched.Not verified