MCPcopy Create free account
hub / github.com/HKUDS/OpenSpace / EvolutionContext

Class EvolutionContext

openspace/skill_engine/evolver.py:121–151  ·  view source on GitHub ↗

Unified context for all evolution triggers. For trigger 1 (ANALYSIS): source_task_id is set, recent_analyses may be just the single triggering analysis. For triggers 2/3: source_task_id is None, recent_analyses are loaded from the skill's historical records.

Source from the content-addressed store, hash-verified

119
120@dataclass
121class EvolutionContext:
122 """Unified context for all evolution triggers.
123
124 For trigger 1 (ANALYSIS): source_task_id is set, recent_analyses may be
125 just the single triggering analysis.
126 For triggers 2/3: source_task_id is None, recent_analyses are loaded
127 from the skill's historical records.
128 """
129 trigger: EvolutionTrigger
130 suggestion: EvolutionSuggestion
131
132 # Parent skill context
133 skill_records: List[SkillRecord] = field(default_factory=list)
134 skill_contents: List[str] = field(default_factory=list)
135 skill_dirs: List[Path] = field(default_factory=list)
136
137 # Task context
138 source_task_id: Optional[str] = None
139 recent_analyses: List[ExecutionAnalysis] = field(default_factory=list)
140
141 # Trigger-specific context
142 tool_issue_summary: str = "" # For TOOL_DEGRADATION
143 metric_summary: str = "" # For METRIC_MONITOR
144
145 # Available tools for agent loop (read_file, web_search, shell, MCP, etc.)
146 available_tools: List["BaseTool"] = field(default_factory=list)
147
148 # For CAPTURED: preferred directory to write the new skill.
149 # Set from the calling host agent's skill directory so captured skills
150 # are written back to the correct host, not always to _skill_dirs[0].
151 capture_dir: Optional[Path] = None
152
153
154class SkillEvolver:

Callers 4

fix_skillFunction · 0.90
process_metric_checkMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected