fix: clean up auto-activated skills per turn and sync skill tools#257
Merged
fix: clean up auto-activated skills per turn and sync skill tools#257
Conversation
Root causes of slow/off-topic skill responses: 1. Auto-activated skills never cleaned up after each turn 2. Skill tools injected but never removed on deactivation 3. LLM intent matching ran even when trigger matches existed Changes: - Add _run_with_auto_skills() for ephemeral per-turn activation/cleanup - Add _sync_skill_tools() to add/remove tools in sync with active skills - Skip LLM intent analysis when keyword triggers already match - Add include_default_paths flag to SkillLoader/SkillManager - Make ToolManager.remove_tool() safe on missing tools - Add tests for ephemeral activation, stale tool removal, intent fallback - Add SKILL_PERF_ANALYSIS.md documenting root causes and fixes
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.
Summary
This PR fixes the main causes of slow and off-topic responses in
SpoonReactSkillskill execution.Root causes addressed
Changes
SkillEnabledMixin:_run_with_auto_skills()auto-activates for current turn and auto-deactivates infinally_sync_skill_tools()now adds missing active skill tools and removes stale tool injections_inject_skill_tools()as backward-compatible aliasSkillManager.find_matching_skills():ToolManager.remove_tool()when tool name does not existinclude_default_pathssupport in skill loading stack:SkillLoader(..., include_default_paths=True)SkillManager(..., include_default_paths=True)tests/test_skills.pyfor:SKILL_PERF_ANALYSIS.mdwith root-cause analysis and expected impactValidation
/home/google/project/spoon-bot/.venv/bin/python -m pytest tests/test_skills.py -qNotes