Enhance tool documentation and add new features
- Added module-level documentation for memory tools (`remember`, `recall`, `forget`) to clarify their purpose. - Improved documentation in `recall.rs` and `remember.rs` to describe the functionality and flow of memory entry operations. - Updated `mod.rs` to include descriptions for the tool trait and execution context. - Enhanced `plan.rs` with detailed comments on plan-mode signaling tools. - Documented text search tools in `search.rs` to explain their functionality. - Improved sequential-thinking tool documentation in `seqthink.rs`. - Added safety filter documentation in `shell_filter` for credential and git operations. - Enhanced utility tools documentation, including `cd`, `dir_cache_update`, and `todowrite`. - Improved rendering documentation in view modules (`chat`, `markdown`, `status`, `workflow`) to clarify rendering flows and purposes.
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
//! Tool for saving a new memory entry to persistent project memory.
|
||||
|
||||
use serde_json::{json, Value};
|
||||
use anyhow::{Result, anyhow};
|
||||
use super::super::Tool;
|
||||
use super::super::ToolCtx;
|
||||
use crate::model::memory::Memory;
|
||||
|
||||
/// Tool that writes a new `Memory` entry (name/description/content/kind) to disk.
|
||||
pub struct Remember;
|
||||
|
||||
impl Tool for Remember {
|
||||
@@ -41,6 +44,16 @@ impl Tool for Remember {
|
||||
})
|
||||
}
|
||||
|
||||
/// Build a `Memory` from the given args and persist it to `ctx.memory_dir`.
|
||||
///
|
||||
/// Flow: extract name/description/content/kind → validate name via `Memory::slugify`
|
||||
/// → construct `Memory` with `lifecycle: "new"` and current timestamps →
|
||||
/// `memory.write`.
|
||||
///
|
||||
/// Why: name must slugify to a valid filename (alphanumeric + hyphens, 1-80 chars)
|
||||
/// since it's used directly as the on-disk file identifier.
|
||||
///
|
||||
/// Return: confirmation string on success; error if name is invalid or the write fails.
|
||||
fn run(&self, ctx: &ToolCtx, args: &Value) -> Result<String> {
|
||||
let name = args.get("name")
|
||||
.and_then(|v| v.as_str())
|
||||
|
||||
Reference in New Issue
Block a user