Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions src/agent/turn_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,16 +602,42 @@ impl Agent {

// Check for skill invocation
if let Some(skill_name) = SkillRegistry::parse_invocation(input) {
if let Some(skill) = skills.get(skill_name) {
let mut skill = skills.get(skill_name).cloned();

// Issue #57 / upstream #59: a `skill_manage reload_all` running
// inside the same session updates the registry, but a CLI
// input handler that captured `skills` at the top of the loop
// sees the old snapshot. On a slash miss, refresh from the
// active session's working directory before reporting Unknown
// skill — same lazy-reload pattern as the TUI input path
// (`src/tui/app/input.rs`).
if skill.is_none() {
let working_dir = self
.session
.working_dir
.as_deref()
.map(std::path::Path::new);
if let Ok(reloaded) = SkillRegistry::load_for_working_dir(working_dir) {
skill = reloaded.get(skill_name).cloned();
// Update the shared registry so subsequent invocations
// and the listing below also see the fresh snapshot.
if let Ok(mut shared) = self.registry.skills().try_write() {
*shared = reloaded;
}
}
}

if let Some(skill) = skill {
println!("Activating skill: {}", skill.name);
println!("{}\n", skill.description);
self.active_skill = Some(skill_name.to_string());
continue;
} else {
println!("Unknown skill: /{}", skill_name);
let fresh = self.current_skills_snapshot();
println!(
"Available: {}",
skills
fresh
.list()
.iter()
.map(|s| format!("/{}", s.name))
Expand Down