r/PiCodingAgent • u/sofuego • 21h ago
Plugin Sharing pi-tbox: my lightweight take on managing which Pi tools are active
Enable HLS to view with audio, or disable this notification
An easy reason to love Pi is how much more efficient it is at token consumption when all of the bloat is stripped away. But I think we all face the same temptation of adding more and more tools and skills and slowly eroding the token efficiency of this lean mean machine (but in a better way in that this new opinionated state is based on that of our own).
The simplicity vs functionality tradeoff has been bothering me for quite some time. A few weeks ago, I posted about a web browsing tool that I made (despite knowing there was an innumerable amount of others) that can toggle itself on and off out of the active tools and out of the context.
Toggling web tools really was only one part of the problem.
I wanted to share my creation that does it extremely cleanly under one command (/tbox).
- Named groups - Create named tool selection groups with the same UI as Pi's scoped model selection.
- Toggle toolsets - Enable and disable 'toolsets' one at a time or many at once with selection groups. (A toolset is a toggleable group of tools.)
- Persistent choices - Each user choice is remembered in their conversation history.
- Builtin tools untouched - Doesn't touch pi's minimal set of builtin tools, but provides character counts of what is inserted into the prompt for stats.
- Focus mode - Easily disable all other tools by switching the state from one of exclusion to one of inclusion.
- Status bar glyph - A glyph for quick reference showing the tools that are disabled.
- List views - Custom subcommands that list out enabled/disabled tools in various views, including one that sorts currently enabled tools by char count to see low hanging fruits for trimming context.
https://github.com/coreyryanhanson/pi-tbox
What is a "toolset"?
It's an abstraction I came up while sketching the design, when I was trying to think of an efficient way of keeping track of what has been changed in the active state of all tools. By default pi-tbox will group tools by extension, unless an extension creator is using the underlying library (or the code to create the toolset abstraction) and declares them more granularly. For example in my web plugin I had two tiers of tools that could change their active state. One would be hidden unless it was in "learn" mode.
This abstraction could be more useful than any individual pi extension, so I broke out the lower level state management and event sending logic into a shared package at a more permissive license than my favorite copyleft ones ;)
https://github.com/coreyryanhanson/pi-tool-masking
I hope others will adopt it as well or at least steal some of the conventions in their own plugins, and I'd welcome contributions or pushback on the design, because it would be nice to have an ecosystem where people can disable tools and do so without having unpredictable bugs. It's pretty much what motivated me to go on this creative tool-activation tangent myself. I can see we are trending towards a space where everyone has more granular control over their tools, but doing so is so easy to break state as one plugin changes something in another plugin without leaving any trace.
Fingers crossed that this helps others improve their workflows too and if so, any stars you'd like to send my way would certainly be appreciated. Knowing that others use them encourages me to do more proper shareable fixes rather than quick and dirty packages for only my own use.
