Module: Legion::Extensions::Agentic::Social::Apprenticeship::Helpers::ApprenticeshipModel

Included in:
Apprenticeship
Defined in:
lib/legion/extensions/agentic/social/apprenticeship/helpers/apprenticeship_model.rb

Constant Summary collapse

MAX_APPRENTICESHIPS =

Capacity limits

100
MAX_SESSIONS =
500
MAX_HISTORY =
300
DEFAULT_MASTERY =

Mastery defaults and bounds

0.1
MASTERY_FLOOR =
0.0
MASTERY_CEILING =
1.0
MASTERY_THRESHOLD =
0.85
PHASE_THRESHOLD =
0.5
LEARNING_GAIN =

Learning dynamics

0.08
COACHING_MULTIPLIER =
1.5
EXPLORATION_MULTIPLIER =
2.0
DECAY_RATE =
0.01
METHODS =

Collins’ six instructional methods

%i[modeling coaching scaffolding articulation reflection exploration].freeze
PHASE_LABELS =

Phase labels derived from mastery range

{
  (0.0...0.2)   => :modeling,
  (0.2...0.4)   => :coaching,
  (0.4...0.6)   => :scaffolding,
  (0.6...0.75)  => :articulation,
  (0.75...0.85) => :reflection,
  (0.85..1.0)   => :exploration
}.freeze
MASTERY_LABELS =

Mastery level labels

{
  (0.8..)     => :expert,
  (0.6...0.8) => :proficient,
  (0.4...0.6) => :intermediate,
  (0.2...0.4) => :apprentice,
  (..0.2)     => :novice
}.freeze

Class Method Summary collapse

Class Method Details

.clamp_mastery(value) ⇒ Object



68
69
70
# File 'lib/legion/extensions/agentic/social/apprenticeship/helpers/apprenticeship_model.rb', line 68

def clamp_mastery(value)
  value.clamp(MASTERY_FLOOR, MASTERY_CEILING)
end

.mastery_label_for(mastery) ⇒ Object



61
62
63
64
65
66
# File 'lib/legion/extensions/agentic/social/apprenticeship/helpers/apprenticeship_model.rb', line 61

def mastery_label_for(mastery)
  MASTERY_LABELS.each do |range, label|
    return label if range.cover?(mastery)
  end
  :expert
end

.new_apprenticeship(skill_name:, domain:, mentor_id:, apprentice_id:) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/legion/extensions/agentic/social/apprenticeship/helpers/apprenticeship_model.rb', line 72

def new_apprenticeship(skill_name:, domain:, mentor_id:, apprentice_id:)
  now = Time.now.utc
  {
    id:              SecureRandom.uuid,
    skill_name:      skill_name,
    domain:          domain,
    mentor_id:       mentor_id,
    apprentice_id:   apprentice_id,
    mastery:         DEFAULT_MASTERY,
    current_phase:   phase_for(DEFAULT_MASTERY),
    session_count:   0,
    created_at:      now,
    last_session_at: nil
  }
end

.phase_for(mastery) ⇒ Object



54
55
56
57
58
59
# File 'lib/legion/extensions/agentic/social/apprenticeship/helpers/apprenticeship_model.rb', line 54

def phase_for(mastery)
  PHASE_LABELS.each do |range, phase|
    return phase if range.cover?(mastery)
  end
  :exploration
end