Files
mimiclaw/main/tools/tool_files.h
crispyberry 31b15aa1f9 feat: add file tools (read/write/edit/list_dir) for agent memory writes
Enable the agent to persist memories by adding 4 SPIFFS file tools
(read_file, write_file, edit_file, list_dir) with path validation,
and update the system prompt with memory guidelines pointing to
/spiffs/memory/MEMORY.md and daily notes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 17:54:52 +08:00

29 lines
867 B
C

#pragma once
#include "esp_err.h"
#include <stddef.h>
/**
* Read a file from SPIFFS.
* Input JSON: {"path": "/spiffs/..."}
*/
esp_err_t tool_read_file_execute(const char *input_json, char *output, size_t output_size);
/**
* Write/overwrite a file on SPIFFS.
* Input JSON: {"path": "/spiffs/...", "content": "..."}
*/
esp_err_t tool_write_file_execute(const char *input_json, char *output, size_t output_size);
/**
* Find-and-replace edit a file on SPIFFS.
* Input JSON: {"path": "/spiffs/...", "old_string": "...", "new_string": "..."}
*/
esp_err_t tool_edit_file_execute(const char *input_json, char *output, size_t output_size);
/**
* List files on SPIFFS, optionally filtered by path prefix.
* Input JSON: {"prefix": "/spiffs/..."} (prefix is optional)
*/
esp_err_t tool_list_dir_execute(const char *input_json, char *output, size_t output_size);