Module: Legion::Extensions::MindGrowth::Runners::Retrospective
- Extended by:
- Retrospective
- Includes:
- Helpers::Lex
- Included in:
- Retrospective
- Defined in:
- lib/legion/extensions/mind_growth/runners/retrospective.rb
Constant Summary collapse
- BUILT_STATUSES =
%i[passing wired active].freeze
- FAILED_STATUSES =
%i[build_failed rejected pruned].freeze
- IN_PROGRESS_STATUSES =
%i[proposed evaluating approved building testing].freeze
- SUCCEEDED_STATUSES =
BUILT_STATUSES
Instance Method Summary collapse
-
#learning_extraction ⇒ Object
Identifies patterns from build failures to improve future LLM prompts.
-
#session_report ⇒ Object
Generates a summary of growth activity: proposals by status, recent builds, failures.
-
#trend_analysis(extensions: []) ⇒ Object
Tracks extension count, quality, coverage over time Returns snapshot metrics suitable for time-series storage.
Instance Method Details
#learning_extraction ⇒ Object
Identifies patterns from build failures to improve future LLM prompts
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/legion/extensions/mind_growth/runners/retrospective.rb', line 66 def learning_extraction(**) all_proposals = Runners::Proposer.list_proposals(limit: 100) proposals = all_proposals[:proposals] failed = proposals.select { |p| p[:status] == :build_failed } rejected = proposals.select { |p| p[:status] == :rejected } succeeded = proposals.select { |p| SUCCEEDED_STATUSES.include?(p[:status]) } # Category success rates category_stats = compute_category_stats(proposals) # Extract patterns from failures failure_patterns = extract_failure_patterns(failed) { success: true, learnings: { total_analyzed: proposals.size, success_rate: proposals.empty? ? 0.0 : (succeeded.size.to_f / proposals.size).round(3), rejection_rate: proposals.empty? ? 0.0 : (rejected.size.to_f / proposals.size).round(3), build_failure_rate: proposals.empty? ? 0.0 : (failed.size.to_f / proposals.size).round(3), category_stats: category_stats, failure_patterns: failure_patterns, recommendations: generate_recommendations(category_stats, failure_patterns) }, generated_at: Time.now.utc } end |
#session_report ⇒ Object
Generates a summary of growth activity: proposals by status, recent builds, failures
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/legion/extensions/mind_growth/runners/retrospective.rb', line 19 def session_report(**) proposals = Runners::Proposer.proposal_stats recent = Runners::Proposer.list_proposals(limit: 10) built = recent[:proposals].select { |p| BUILT_STATUSES.include?(p[:status]) } failed = recent[:proposals].select { |p| FAILED_STATUSES.include?(p[:status]) } in_progress = recent[:proposals].select { |p| IN_PROGRESS_STATUSES.include?(p[:status]) } { success: true, summary: { total_proposals: proposals[:stats][:total], by_status: proposals[:stats][:by_status], recent_built: built.map { |p| { id: p[:id], name: p[:name], status: p[:status] } }, recent_failed: failed.map { |p| { id: p[:id], name: p[:name], status: p[:status] } }, in_progress: in_progress.map { |p| { id: p[:id], name: p[:name], status: p[:status] } } }, generated_at: Time.now.utc } end |
#trend_analysis(extensions: []) ⇒ Object
Tracks extension count, quality, coverage over time Returns snapshot metrics suitable for time-series storage
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/legion/extensions/mind_growth/runners/retrospective.rb', line 42 def trend_analysis(extensions: [], **) profile = Runners::Analyzer.cognitive_profile(existing_extensions: extensions.empty? ? nil : extensions) ranked = extensions.empty? ? [] : Helpers::FitnessEvaluator.rank(extensions) avg_fitness = ranked.empty? ? 0.0 : (ranked.sum { |e| e[:fitness] } / ranked.size).round(3) prune_count = ranked.count { |e| e[:fitness] < Helpers::Constants::PRUNE_THRESHOLD } healthy_count = ranked.count { |e| e[:fitness] >= Helpers::Constants::IMPROVEMENT_THRESHOLD } { success: true, snapshot: { extension_count: ranked.size, overall_coverage: profile[:overall_coverage], model_coverage: profile[:model_coverage]&.map { |m| { model: m[:model], coverage: m[:coverage] } }, avg_fitness: avg_fitness, healthy_extensions: healthy_count, prune_candidates: prune_count, improvement_candidates: ranked.size - healthy_count - prune_count }, generated_at: Time.now.utc } end |