Enhance logging and documentation across utility tools and TUI overlays

- Added tracing instrumentation and improved logging messages in the Pong, Todofinish, and Todowrite tools for better debugging and monitoring.
- Enhanced documentation comments for clarity on tool functionalities and workflows.
- Implemented tracing in WorkflowRun, NoteFinding, ReadFindings, and HiveMind tools to track execution phases and findings.
- Updated TUI overlays (e.g., Bash, Clear Confirm, Editor, Effort Level, Help, Key Input, Learning, Loading, MCP, Model Selector, Plan, Quit Confirm, Rewind, Settings, Todo, Usage) with debug logging to capture rendering details.
- Improved the status bar and workflow panel rendering with additional debug information.
- Added tracing to various utility functions to facilitate better performance monitoring and error tracking.
This commit is contained in:
asepharyana
2026-07-20 15:53:43 +07:00
parent f84dfb8476
commit 16494d4b1e
69 changed files with 637 additions and 30 deletions
@@ -1,11 +1,20 @@
//! Remember a lesson or fact as persistent memory.
//!
//! Constructs a `Memory` struct from tool arguments and persists it
//! via `MarkdownMemoryRepository` to the memory directory.
use crate::tools::{Tool, ToolCtx};
use anyhow::Result;
use serde_json::{json, Value};
use tracing::{info, instrument};
use zesdex_domain::cms::{Memory, MemoryRepository};
/// Tool that saves a lesson or fact to persistent memory.
///
/// Flow: parse name/description/content/kind → construct a `Memory` struct
/// with timestamps → instantiate `MarkdownMemoryRepository` → call
/// `repo.save()` with the memory directory → confirm save.
pub struct Remember;
impl Tool for Remember {
@@ -43,6 +52,7 @@ impl Tool for Remember {
})
}
#[instrument(skip(self, ctx, args))]
fn run(&self, ctx: &ToolCtx, args: &Value) -> Result<String> {
let name = crate::tools::arg_str(args, "name")?;
let description = crate::tools::arg_str(args, "description")?;
@@ -53,6 +63,8 @@ impl Tool for Remember {
.unwrap_or("reference")
.to_string();
info!(name, kind, "remember invoked");
let memory = Memory {
name: name.clone(),
description,
@@ -71,6 +83,7 @@ impl Tool for Remember {
let repo = crate::persistence::cms::memory_repo::MarkdownMemoryRepository::new();
repo.save(&ctx.memory_dir, &memory)?;
info!(name, "memory saved");
Ok(format!("Memory '{}' saved", name))
}
}