feat(tui): update system message for clarity and conciseness in tool usage instructions
This commit is contained in:
@@ -33,13 +33,26 @@ impl Tool for Todowrite {
|
||||
})
|
||||
}
|
||||
|
||||
fn run(&self, _ctx: &ToolCtx, args: &Value) -> Result<String> {
|
||||
fn run(&self, ctx: &ToolCtx, args: &Value) -> Result<String> {
|
||||
let item = crate::tools::arg_str(args, "item")?;
|
||||
let priority = args
|
||||
.get("priority")
|
||||
.and_then(|v| v.as_str())
|
||||
.unwrap_or("medium");
|
||||
|
||||
let todo_line = format!("- [{}] {}\n", priority, item);
|
||||
|
||||
let todo_path = ctx.session_dir.join("TODO.md");
|
||||
let mut content = std::fs::read_to_string(&todo_path).unwrap_or_default();
|
||||
content.push_str(&todo_line);
|
||||
|
||||
let _ = std::fs::write(&todo_path, &content);
|
||||
|
||||
if let Some(events) = &ctx.turn_events {
|
||||
let mut q = events.lock().unwrap();
|
||||
q.push_back(crate::TurnEvent::TodoUpdate(content));
|
||||
}
|
||||
|
||||
Ok(format!("[{}] TODO added: {}", priority, item))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user