Class: RubynCode::Learning::Instinct
- Inherits:
-
Data
- Object
- Data
- RubynCode::Learning::Instinct
- Defined in:
- lib/rubyn_code/learning/instinct.rb
Overview
Represents a learned pattern with confidence tracking and time-based decay.
Instincts are project-scoped patterns extracted from user sessions that can be injected into future system prompts to improve agent behavior.
Instance Attribute Summary collapse
-
#confidence ⇒ Object
readonly
Returns the value of attribute confidence.
-
#context_tags ⇒ Object
readonly
Returns the value of attribute context_tags.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#decay_rate ⇒ Object
readonly
Returns the value of attribute decay_rate.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
-
#project_path ⇒ Object
readonly
Returns the value of attribute project_path.
-
#times_applied ⇒ Object
readonly
Returns the value of attribute times_applied.
-
#times_helpful ⇒ Object
readonly
Returns the value of attribute times_helpful.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
Instance Method Summary collapse
-
#initialize(id:, project_path:, pattern:, context_tags: [], confidence: 0.5, decay_rate: 0.05, times_applied: 0, times_helpful: 0, created_at: Time.now, updated_at: Time.now) ⇒ Instinct
constructor
A new instance of Instinct.
Constructor Details
#initialize(id:, project_path:, pattern:, context_tags: [], confidence: 0.5, decay_rate: 0.05, times_applied: 0, times_helpful: 0, created_at: Time.now, updated_at: Time.now) ⇒ Instinct
Returns a new instance of Instinct.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/rubyn_code/learning/instinct.rb', line 23 def initialize(id:, project_path:, pattern:, context_tags: [], confidence: 0.5, decay_rate: 0.05, times_applied: 0, times_helpful: 0, created_at: Time.now, updated_at: Time.now) super( id: id, project_path: project_path, pattern: pattern, context_tags: Array(), confidence: confidence.to_f.clamp(0.0, 1.0), decay_rate: decay_rate.to_f, times_applied: times_applied.to_i, times_helpful: times_helpful.to_i, created_at: created_at, updated_at: updated_at ) end |
Instance Attribute Details
#confidence ⇒ Object (readonly)
Returns the value of attribute confidence
11 12 13 |
# File 'lib/rubyn_code/learning/instinct.rb', line 11 def confidence @confidence end |
#context_tags ⇒ Object (readonly)
Returns the value of attribute context_tags
11 12 13 |
# File 'lib/rubyn_code/learning/instinct.rb', line 11 def @context_tags end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at
11 12 13 |
# File 'lib/rubyn_code/learning/instinct.rb', line 11 def created_at @created_at end |
#decay_rate ⇒ Object (readonly)
Returns the value of attribute decay_rate
11 12 13 |
# File 'lib/rubyn_code/learning/instinct.rb', line 11 def decay_rate @decay_rate end |
#id ⇒ Object (readonly)
Returns the value of attribute id
11 12 13 |
# File 'lib/rubyn_code/learning/instinct.rb', line 11 def id @id end |
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern
11 12 13 |
# File 'lib/rubyn_code/learning/instinct.rb', line 11 def pattern @pattern end |
#project_path ⇒ Object (readonly)
Returns the value of attribute project_path
11 12 13 |
# File 'lib/rubyn_code/learning/instinct.rb', line 11 def project_path @project_path end |
#times_applied ⇒ Object (readonly)
Returns the value of attribute times_applied
11 12 13 |
# File 'lib/rubyn_code/learning/instinct.rb', line 11 def times_applied @times_applied end |
#times_helpful ⇒ Object (readonly)
Returns the value of attribute times_helpful
11 12 13 |
# File 'lib/rubyn_code/learning/instinct.rb', line 11 def times_helpful @times_helpful end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at
11 12 13 |
# File 'lib/rubyn_code/learning/instinct.rb', line 11 def updated_at @updated_at end |