From a505b9384e9346f8f04ac51bb696de9cd1b4a961 Mon Sep 17 00:00:00 2001 From: ProofOfConcept Date: Tue, 10 Mar 2026 16:03:10 -0400 Subject: [PATCH] agents: fix agent file parser to split on first newline The parser was using split_once("\n\n") which broke when the prompt started immediately after the JSON header (no blank line). Parse the first line as JSON, treat the rest as the prompt body. --- poc-memory/src/agents/defs.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/poc-memory/src/agents/defs.rs b/poc-memory/src/agents/defs.rs index ca5c7a6..05d7f4f 100644 --- a/poc-memory/src/agents/defs.rs +++ b/poc-memory/src/agents/defs.rs @@ -50,8 +50,10 @@ fn default_model() -> String { "sonnet".into() } /// Parse an agent file: first line is JSON config, rest is the prompt. fn parse_agent_file(content: &str) -> Option { - let (header_str, prompt) = content.split_once("\n\n")?; - let header: AgentHeader = serde_json::from_str(header_str.trim()).ok()?; + let (first_line, rest) = content.split_once('\n')?; + let header: AgentHeader = serde_json::from_str(first_line.trim()).ok()?; + // Skip optional blank line between header and prompt body + let prompt = rest.strip_prefix('\n').unwrap_or(rest); Some(AgentDef { agent: header.agent, query: header.query,