Repository navigation
Let a person give unknown tools a built-in role (tool_roles) - #269
Open
Kirill (AJIADb9) wants to merge 2 commits into
Open
Kirill (AJIADb9) wants to merge 2 commits into
Kirill (AJIADb9) wants to merge 2 commits into
Conversation
On Windows, Claude Code runs commands through its PowerShell tool, whose
input is {"command": ...} like Bash's. Micro-skills only read bash, shell
and stop_bash, so every Windows session folded with no commands and no fact
could form; the loop guard did not count those calls either.
One SHELL_TOOLS set in trace names the shell tools for the observer and the
distiller, the loop guard canonicalises powershell to bash, and tool pruning
protects PowerShell. A command head's .exe suffix is dropped, so
C:\Python312\python.exe reads as the python interpreter.
The mechanisms know tools by name, so an MCP server's edit or shell tool taught them nothing: a loop of edits through Serena's replace_content never counted as edit churn, and commands run through an MCP shell tool formed no micro-skill. The new tool_roles setting maps a tool name or pattern to a role, shell, edit or read, as comma-separated tool=role entries (mcp__serena__replace_content=edit). trace.tool_kind reads such a tool as the built-in one; the plugin sets the roles whenever it loads its configuration. Edit tools are also read through relative_path, which is how Serena names the file it changes. A malformed entry is rejected with a warning, as other settings are.
|
Kirill (@AJIADb9) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
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.
Builds on #268 (it uses its
trace.SHELL_TOOLS); review that one first.The mechanisms know tools by name, so an MCP server's edit or shell tool teaches them nothing. A loop of edits through Serena's
replace_contentnever counts as edit churn, and commands run through an MCP shell tool form no micro-skill.The new
tool_rolessetting maps a tool name or pattern to the role of a built-in tool, as comma-separatedtool=roleentries:shell,editandread; they read asbash,editandread.trace.tool_kindapplies the roles; micro-skills (observer, distiller,edited_files) and the loop guard (canon_tool) read tool names through it.plugin/context.py), so hooks and the detached fold both see them.relative_path, which is how Serena names the file it changes.TE_TOOL_ROLESsets it from the environment.Tests are in
tests/test_tool_roles.py;python -m pytest tests experiments/testspasses.