Package com.tnsai.skills
Class SkillSession
java.lang.Object
com.tnsai.skills.SkillSession
Per-agent runtime state for the skill layer (TNS-289). Tracks which
skills the agent has activated during the current session so the
full bodies can be persistently appended to the system prompt
after the first invocation.
The session deliberately decouples activation order (insertion
order, mirrored via LinkedHashMap) from registration order
— the first invocation of a skill is what defines its position in
the prompt, matching Claude Code's behaviour.
Concurrency
The session is shared by every dispatch on the same agent and skill activation is rare relative to chat turns, so a coarseReentrantLock is fine — fewer concurrency bugs to chase
than a striped or lock-free design.- Since:
- 0.10.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionActivateskillwith the suppliedargumentsand environment.Snapshot of currently active skills, in activation order.voidclear()Drop every active skill.deactivate(String name) Detach an active skill — its body is no longer appended to the system prompt.booleanTrue if a skill with the given (case-insensitive) name is active.
-
Constructor Details
-
SkillSession
public SkillSession()
-
-
Method Details
-
activate
Activateskillwith the suppliedargumentsand environment. Re-activating an already-active skill REPLACES the previous snapshot — the latest invocation's substituted body wins. -
deactivate
Detach an active skill — its body is no longer appended to the system prompt. Returns the snapshot if one was present. -
activeSkills
Snapshot of currently active skills, in activation order. -
isActive
True if a skill with the given (case-insensitive) name is active. -
clear
public void clear()Drop every active skill. Useful for tests and for conversation resets.
-