feat: add agent loop and context builder
Agent loop runs on Core 1: pops inbound messages, builds system prompt from bootstrap files + memory, calls Claude API, saves session, pushes response to outbound queue. PSRAM-allocated buffers. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
25
main/agent/context_builder.h
Normal file
25
main/agent/context_builder.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "esp_err.h"
|
||||
#include <stddef.h>
|
||||
|
||||
/**
|
||||
* Build the system prompt from bootstrap files (SOUL.md, USER.md)
|
||||
* and memory context (MEMORY.md + recent daily notes).
|
||||
*
|
||||
* @param buf Output buffer (caller allocates, recommend MIMI_CONTEXT_BUF_SIZE)
|
||||
* @param size Buffer size
|
||||
*/
|
||||
esp_err_t context_build_system_prompt(char *buf, size_t size);
|
||||
|
||||
/**
|
||||
* Build the complete messages JSON array for LLM call.
|
||||
* Combines session history + current user message.
|
||||
*
|
||||
* @param history_json JSON array from session_get_history_json()
|
||||
* @param user_message Current user message text
|
||||
* @param buf Output buffer
|
||||
* @param size Buffer size
|
||||
*/
|
||||
esp_err_t context_build_messages(const char *history_json, const char *user_message,
|
||||
char *buf, size_t size);
|
||||
Reference in New Issue
Block a user