fix: create Memo for fresh users in headless mode

Adds same "fresh user → create Memo" logic to headless mode that
interactive mode has. Now `letta -p "hello"` works for fresh users
without needing --new-agent.

🐺 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta <noreply@letta.com>
This commit is contained in:
cpacker
2026-01-16 15:16:42 -08:00
parent adea8c24e8
commit 1211e5addb

View File

@@ -448,8 +448,16 @@ export async function handleHeadlessCommand(
}
}
// Priority 6: Fresh user with no LRU - create Memo (same as interactive mode)
if (!agent) {
const { ensureDefaultAgents } = await import("./agent/defaults");
const memoAgent = await ensureDefaultAgents(client);
if (memoAgent) {
agent = memoAgent;
}
}
// All paths should have resolved to an agent by now
// If not, it's an unexpected state - error out instead of auto-creating
if (!agent) {
console.error("No agent found. Use --new-agent to create a new agent.");
process.exit(1);