Skip to main content

Module agent_md_loader

Module agent_md_loader 

Source
Expand description

agent.md frontmatter + body loader — turns agent-profiles agents/*.md files into AgentDefs.

§Input format

---
name: impl-lead
description: Implementation worker ...
model: sonnet
effort: high
tools: Read, Edit, Write, Grep, Glob
permissionMode: bypassPermissions
memory: user
abtest: true
---
<Markdown system prompt body>

§Output

A Vec<AgentDef> — each entry carries profile: Some(AgentProfile { ... }), kind defaults to AgentKind::Operator, and spec is Value::Null. The backend configuration (spec) is injected separately by the caller — on the Operator-construction path.

§Scope

  • Only YAML frontmatter delimited by --- is accepted. TOML and JSON are not supported.
  • tools accepts both a CSV string ("Read, Edit") and a YAML array (["Read", "Edit"]).
  • Any field beyond the known set (name / description / model / effort / tools) is dumped into an extras Value — a future-proof carry for C-C-specific fields.
  • The body is kept verbatim, from just after the closing --- to the end of the file.

Enums§

LoadError
Errors specific to the agent.md loader.

Functions§

compute_body_hash
Compute the content hash of an agent body (its system_prompt).
load_dir
Load every *.md under dir. Sorted ascending by file name.
load_file
Turn a single agent.md file into an AgentDef.
parse
Turn the text of an agent.md into an AgentDef. pub so unit tests can reach it. kind must be provided by the caller — same contract as load_file.