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

Method process_analysis

openspace/skill_engine/evolver.py:266–307  ·  view source on GitHub ↗

Process all evolution suggestions from a completed analysis. Called immediately after ``ExecutionAnalyzer.analyze_execution()``. Each suggestion becomes one evolution action, executed in parallel (throttled by semaphore). Args: analysis: The completed ex

(
        self,
        analysis: ExecutionAnalysis,
        capture_dir: Optional[Path] = None,
    )

Source from the content-addressed store, hash-verified

264
265 # Trigger 1: post-analysis
266 async def process_analysis(
267 self,
268 analysis: ExecutionAnalysis,
269 capture_dir: Optional[Path] = None,
270 ) -> List[SkillRecord]:
271 """Process all evolution suggestions from a completed analysis.
272
273 Called immediately after ``ExecutionAnalyzer.analyze_execution()``.
274 Each suggestion becomes one evolution action, executed in parallel
275 (throttled by semaphore).
276
277 Args:
278 analysis: The completed execution analysis.
279 capture_dir: Preferred directory for CAPTURED skills (host agent's
280 skill dir). Falls back to ``registry._skill_dirs[0]`` when None.
281 """
282 if not analysis.candidate_for_evolution:
283 return []
284
285 # Build contexts first (cheap, no LLM calls)
286 contexts: List[EvolutionContext] = []
287 for suggestion in analysis.evolution_suggestions:
288 ctx = self._build_context_from_analysis(
289 analysis, suggestion, capture_dir=capture_dir,
290 )
291 if ctx is not None:
292 contexts.append(ctx)
293
294 if not contexts:
295 return []
296
297 results = await self._execute_contexts(contexts, "analysis")
298
299 if results:
300 names = [r.name for r in results]
301 logger.info(
302 f"[Trigger:analysis] Evolved {len(results)} skill(s): {names} "
303 f"from task {analysis.task_id}"
304 )
305
306 self._store.mark_evolution_processed(analysis.task_id)
307 return results
308
309 # Trigger 2: tool quality degradation
310 async def process_tool_degradation(

Callers 1

Calls 4

_execute_contextsMethod · 0.95
infoMethod · 0.80

Tested by

no test coverage detected