feat: add scan_evolution_opportunities MCP tool for agent-driven skill evolution#25
Open
xzq-xu wants to merge 1 commit intoHKUDS:mainfrom
Open
feat: add scan_evolution_opportunities MCP tool for agent-driven skill evolution#25xzq-xu wants to merge 1 commit intoHKUDS:mainfrom
xzq-xu wants to merge 1 commit intoHKUDS:mainfrom
Conversation
b17b7ba to
3165b94
Compare
3165b94 to
df545a3
Compare
Add a new MCP tool that bridges the gap between fully automatic evolution (inside execute_task) and manual repair (fix_skill). scan_evolution_opportunities lets host agents proactively inspect which skills could benefit from evolution by: 1. Loading execution analyses marked as evolution candidates 2. Enriching each with SkillRecord usage statistics (completion rate, fallback rate, effective rate) 3. Returning a structured JSON report with prioritized suggestions This enables an "agent-in-the-loop" evolution pattern for all host agents (Claude Code, Codex, nanobot, Cursor, etc.): periodic scan, review report, selectively apply fixes. Closes HKUDS#24 Made-with: Cursor
df545a3 to
21076ce
Compare
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
Add a new MCP tool
scan_evolution_opportunitiesthat bridges the gap between fully automatic evolution (insideexecute_task) and manual repair (fix_skill).The current MCP tool set lacks a way for host agents to proactively inspect which skills could benefit from evolution and make their own decisions. The data already exists in
SkillStore(evolution candidates, execution analyses, skill usage stats) — this PR simply exposes it through a new MCP tool.What it does
ExecutionAnalysisrecords marked as evolution candidatesSkillRecordusage statistics (completion rate, fallback rate, effective rate, selection/applied/completion/fallback counts)Return shape
{ "candidates": [ { "skill_id": "weather__imp_a1b2c3d4", "skill_name": "weather", "description": "...", "stats": { "total_selections": 10, "completion_rate": 0.6, "fallback_rate": 0.3 }, "suggestions": [ { "type": "fix", "direction": "...", "target_skills": ["..."] } ], "source_task_id": "...", "task_completed": false, "execution_note": "...", "analyzed_at": "..." } ], "total_candidates": 5, "total_active_skills": 42, "scan_summary": "Found 5 evolution candidate(s) across 42 active skill(s): 3 FIX, 1 DERIVED, 1 CAPTURED" }Use case: agent-in-the-loop evolution
This enables a pattern for all host agents (Claude Code, Codex, nanobot, Cursor, etc.):
scan_evolution_opportunitiesperiodically (e.g. via cron)fix_skill(or defers)This is the "agent-in-the-loop" complement to the fully automatic evolution pipeline, filling the gap in the README's "Quality monitoring — Tracks skill performance, error rates, and execution success across all tasks" promise.
Implementation
SkillStore.load_evolution_candidates(),load_record(),count()_get_openspace(),_get_store(),_auto_register_skill_dirs)_json_error()convention (no traceback leakage)Test plan
candidatesarray when no evolution candidates existskill_dirsparameter triggers registration before scanningmax_candidateslimits output correctlyscan_summaryincludes correct type countsCloses #24
Made with Cursor