7814
Ta
tiny-c-agent / files
tiny-c-agent / src / resources.h
1.0 KB
1// tiny resources: the system prompt and the files it is built from. 2 3#ifndef TINY_RESOURCES_H 4#define TINY_RESOURCES_H 5 6#include <stddef.h> 7 8#include "config.h" 9 10// One discovered AGENTS.md/CLAUDE.md. 11typedef struct { 12 char *path; 13} tiny_agent_file; 14 15// One SKILL.md, with the name and description taken from its frontmatter. 16typedef struct { 17 char *name; 18 char *description; 19 char *path; 20} tiny_skill; 21 22typedef struct { 23 char *system_prompt; // always set, possibly empty 24 tiny_agent_file *agent_files; 25 size_t agent_files_len; 26 tiny_skill *skills; 27 size_t skills_len; 28} tiny_resources; 29 30// Builds the system prompt from the configured prompt file, the discovered 31// SKILL.md files, and the discovered agent files, in that order. `cwd` is the 32// working directory searched for agent files. Returns NULL with *err set on 33// failure (an unreadable configured prompt file). 34tiny_resources *tiny_resources_build(const tiny_config *cfg, const char *cwd, char **err); 35 36void tiny_resources_free(tiny_resources *r); 37 38#endif