Module: Rubino::ActiveSkill
- Defined in:
- lib/rubino/active_skill.rb
Overview
In-process switch holding the ONE skill the user has pinned active for the session (MVP: one at a time). Mirrors Rubino::Modes: a process-level slot, set via ‘/skills <name>` (the completion-dropdown picker) and cleared via `/skills none`. The active skill is force-loaded into the system prompt each turn (Context::PromptAssembler), so the model actually uses it — not just a cosmetic chip.
Lives at the process level intentionally — alpha rule: no premature persistence. A fresh ‘rubino chat` boots with NO active skill; an explicit `/skills <name>` takes effect for the rest of that process. We can move it onto Session later if users want it sticky across restarts.
The sentinel “none” (and the ‘✗ none` dropdown entry) clears the slot.
Constant Summary collapse
- NONE =
The dropdown/CLI sentinel that clears the active skill.
"none"
Class Attribute Summary collapse
-
.current ⇒ Object
readonly
The active skill name (String), or nil when none is pinned.
Class Method Summary collapse
-
.active? ⇒ Boolean
True when a skill is pinned.
-
.clear ⇒ Object
Clears the active skill (the ‘/skills none` / `✗ none` path).
-
.reset! ⇒ Object
Test/teardown hook.
-
.set(name) ⇒ Object
Pins
nameas the active skill.
Class Attribute Details
.current ⇒ Object (readonly)
The active skill name (String), or nil when none is pinned.
23 24 25 |
# File 'lib/rubino/active_skill.rb', line 23 def current @current end |
Class Method Details
.active? ⇒ Boolean
True when a skill is pinned.
40 41 42 |
# File 'lib/rubino/active_skill.rb', line 40 def active? !@current.nil? end |
.clear ⇒ Object
Clears the active skill (the ‘/skills none` / `✗ none` path).
35 36 37 |
# File 'lib/rubino/active_skill.rb', line 35 def clear @current = nil end |
.reset! ⇒ Object
Test/teardown hook. Not part of the public API.
45 46 47 |
# File 'lib/rubino/active_skill.rb', line 45 def reset! @current = nil end |
.set(name) ⇒ Object
Pins name as the active skill. A nil/empty/“none” clears it. Returns the new value (the name String, or nil when cleared). The caller is responsible for validating the name against the registry BEFORE calling this — ActiveSkill is a dumb slot, like Modes.
29 30 31 32 |
# File 'lib/rubino/active_skill.rb', line 29 def set(name) normalized = name.to_s.strip @current = normalized.empty? || normalized.casecmp?(NONE) ? nil : normalized end |