feat(skills): add read_skill for compact mode

This commit is contained in:
Alix-007
2026-03-19 17:53:40 +08:00
committed by Roman Tataurov
parent 40e2aaa318
commit d43ce63b4d
7 changed files with 310 additions and 2 deletions
+18
View File
@@ -3474,6 +3474,15 @@ pub async fn run(
"Delete a memory entry. Use when: memory is incorrect/stale or explicitly requested for removal. Don't use when: impact is uncertain.",
),
];
if matches!(
config.skills.prompt_injection_mode,
crate::config::SkillsPromptInjectionMode::Compact
) {
tool_descs.push((
"read_skill",
"Load the full source for an available skill by name. Use when: compact mode only shows a summary and you need the complete skill instructions.",
));
}
tool_descs.push((
"cron_add",
"Create a cron job. Supports schedule kinds: cron, at, every; and job types: shell or agent.",
@@ -4161,6 +4170,15 @@ pub async fn process_message(
("screenshot", "Capture a screenshot."),
("image_info", "Read image metadata."),
];
if matches!(
config.skills.prompt_injection_mode,
crate::config::SkillsPromptInjectionMode::Compact
) {
tool_descs.push((
"read_skill",
"Load the full source for an available skill by name.",
));
}
if config.browser.enabled {
tool_descs.push(("browser_open", "Open approved URLs in browser."));
}
+1
View File
@@ -436,6 +436,7 @@ mod tests {
assert!(output.contains("<available_skills>"));
assert!(output.contains("<name>deploy</name>"));
assert!(output.contains("<location>skills/deploy/SKILL.md</location>"));
assert!(output.contains("read_skill(name)"));
assert!(!output.contains("<instruction>Run smoke tests before deploy.</instruction>"));
assert!(!output.contains("<tools>"));
}