Skip to content

Commit ceb8105

Browse files
committed
feat(summon): auto-include markdown supporting files when loading skills
Supporting files were only listed as paths with "use file tools to read these" — but environments without the developer extension (e.g. slackbots) have no file-reading tools, making reference files unreachable. Now .md/.mdx supporting files are read and included inline alongside the SKILL.md content, consistent with how SKILL.md itself is already read and included. Non-markdown files continue to be listed as paths.
1 parent b43302a commit ceb8105

1 file changed

Lines changed: 29 additions & 7 deletions

File tree

  • crates/goose/src/agents/platform_extensions

crates/goose/src/agents/platform_extensions/summon.rs

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,18 +1054,40 @@ impl SummonClient {
10541054
);
10551055

10561056
if !source.supporting_files.is_empty() {
1057-
output.push_str(&format!(
1058-
"\n## Supporting Files\n\nSkill directory: {}\n\nThe following supporting files are available:\n",
1059-
source.path.display()
1060-
));
1057+
let mut other_files: Vec<std::path::PathBuf> = Vec::new();
1058+
10611059
for file in &source.supporting_files {
1060+
let is_md = file
1061+
.extension()
1062+
.map_or(false, |ext| ext == "md" || ext == "mdx");
1063+
10621064
if let Ok(relative) = file.strip_prefix(&source.path) {
1065+
if is_md {
1066+
if let Ok(file_content) = std::fs::read_to_string(file) {
1067+
output.push_str(&format!(
1068+
"\n## {}\n\n{}\n",
1069+
relative.display(),
1070+
file_content.trim()
1071+
));
1072+
}
1073+
} else {
1074+
other_files.push(relative.to_path_buf());
1075+
}
1076+
}
1077+
}
1078+
1079+
if !other_files.is_empty() {
1080+
output.push_str(&format!(
1081+
"\n## Other Files\n\nSkill directory: {}\n\n",
1082+
source.path.display()
1083+
));
1084+
for relative in &other_files {
10631085
output.push_str(&format!("- {}\n", relative.display()));
10641086
}
1087+
output.push_str(
1088+
"\nUse the file tools to read these files or run scripts as directed.\n",
1089+
);
10651090
}
1066-
output.push_str(
1067-
"\nUse the file tools to read these files or run scripts as directed.\n",
1068-
);
10691091
}
10701092

10711093
output.push_str("\n---\nThis knowledge is now available in your context.");

0 commit comments

Comments
 (0)