chore: avoid hardcoding file paths via MIMI_SPIFFS_BASE

Use MIMI_SPIFFS_BASE to centralize file path definitions, making the
base path configurable instead of hardcoded.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
Bin Meng
2026-02-26 09:26:26 +08:00
parent f9086e4f89
commit 22886cf0f2
7 changed files with 49 additions and 43 deletions

View File

@@ -40,10 +40,10 @@ esp_err_t context_build_system_prompt(char *buf, size_t size)
"Use this when you need up-to-date facts, news, weather, or anything beyond your training data.\n"
"- get_current_time: Get the current date and time. "
"You do NOT have an internal clock — always use this tool when you need to know the time or date.\n"
"- read_file: Read a file from SPIFFS (path must start with /spiffs/).\n"
"- write_file: Write/overwrite a file on SPIFFS.\n"
"- edit_file: Find-and-replace edit a file on SPIFFS.\n"
"- list_dir: List files on SPIFFS, optionally filter by prefix.\n"
"- read_file: Read a file (path must start with " MIMI_SPIFFS_BASE "/).\n"
"- write_file: Write/overwrite a file.\n"
"- edit_file: Find-and-replace edit a file.\n"
"- list_dir: List files, optionally filter by prefix.\n"
"- cron_add: Schedule a recurring or one-shot task. The message will trigger an agent turn when the job fires.\n"
"- cron_list: List all scheduled cron jobs.\n"
"- cron_remove: Remove a scheduled cron job by ID.\n\n"
@@ -51,8 +51,8 @@ esp_err_t context_build_system_prompt(char *buf, size_t size)
"Use tools when needed. Provide your final answer as text after using tools.\n\n"
"## Memory\n"
"You have persistent memory stored on local flash:\n"
"- Long-term memory: /spiffs/memory/MEMORY.md\n"
"- Daily notes: /spiffs/memory/daily/<YYYY-MM-DD>.md\n\n"
"- Long-term memory: " MIMI_SPIFFS_MEMORY_DIR "/MEMORY.md\n"
"- Daily notes: " MIMI_SPIFFS_MEMORY_DIR "/daily/<YYYY-MM-DD>.md\n\n"
"IMPORTANT: Actively use memory to remember things across conversations.\n"
"- When you learn something new about the user (name, preferences, habits, context), write it to MEMORY.md.\n"
"- When something noteworthy happens in a conversation, append it to today's daily note.\n"
@@ -61,9 +61,9 @@ esp_err_t context_build_system_prompt(char *buf, size_t size)
"- Keep MEMORY.md concise and organized — summarize, don't dump raw conversation.\n"
"- You should proactively save memory without being asked. If the user tells you their name, preferences, or important facts, persist them immediately.\n\n"
"## Skills\n"
"Skills are specialized instruction files stored in /spiffs/skills/.\n"
"Skills are specialized instruction files stored in " MIMI_SKILLS_PREFIX ".\n"
"When a task matches a skill, read the full skill file for detailed instructions.\n"
"You can create new skills using write_file to /spiffs/skills/<name>.md.\n");
"You can create new skills using write_file to " MIMI_SKILLS_PREFIX "<name>.md.\n");
/* Bootstrap files */
off = append_file(buf, size, off, MIMI_SOUL_FILE, "Personality");