Remember a successful pattern
(
&self,
prompt: &str,
tools_used: &[String],
result: &str,
)
| 158 | |
| 159 | /// Remember a successful pattern |
| 160 | pub async fn remember_success( |
| 161 | &self, |
| 162 | prompt: &str, |
| 163 | tools_used: &[String], |
| 164 | result: &str, |
| 165 | ) -> anyhow::Result<()> { |
| 166 | let content = format!( |
| 167 | "Success: {}\nTools: {}\nResult: {}", |
| 168 | prompt, |
| 169 | tools_used.join(", "), |
| 170 | result |
| 171 | ); |
| 172 | let item = MemoryItem::new(content) |
| 173 | .with_importance(0.8) |
| 174 | .with_tag("success") |
| 175 | .with_tag("pattern") |
| 176 | .with_type(MemoryType::Procedural) |
| 177 | .with_metadata("prompt", prompt) |
| 178 | .with_metadata("tools", tools_used.join(",")); |
| 179 | self.remember(item).await |
| 180 | } |
| 181 | |
| 182 | /// Remember a failure to avoid repeating |
| 183 | pub async fn remember_failure( |