feat: add --memfs / --no-memfs CLI flags (#747)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2026-01-29 16:51:35 -08:00
committed by GitHub
parent 160e0123f5
commit 9fd87240f9
2 changed files with 24 additions and 0 deletions

View File

@@ -120,6 +120,8 @@ export async function handleHeadlessCommand(
"base-tools": { type: "string" },
"from-af": { type: "string" },
"no-skills": { type: "boolean" },
memfs: { type: "boolean" },
"no-memfs": { type: "boolean" },
},
strict: false,
allowPositionals: true,
@@ -235,6 +237,8 @@ export async function handleHeadlessCommand(
const initBlocksRaw = values["init-blocks"] as string | undefined;
const baseToolsRaw = values["base-tools"] as string | undefined;
const sleeptimeFlag = (values.sleeptime as boolean | undefined) ?? undefined;
const memfsFlag = values.memfs as boolean | undefined;
const noMemfsFlag = values["no-memfs"] as boolean | undefined;
const fromAfFile = values["from-af"] as string | undefined;
// Handle --conv {agent-id} shorthand: --conv agent-xyz → --agent agent-xyz --conv default
@@ -585,6 +589,13 @@ export async function handleHeadlessCommand(
}
}
// Apply memfs flag if specified
if (memfsFlag) {
settingsManager.setMemfsEnabled(agent.id, true);
} else if (noMemfsFlag) {
settingsManager.setMemfsEnabled(agent.id, false);
}
// Sync filesystem-backed memory before creating conversations (only if memfs is enabled)
if (settingsManager.isMemfsEnabled(agent.id)) {
try {

View File

@@ -74,6 +74,8 @@ OPTIONS
--skills <path> Custom path to skills directory (default: .skills in current directory)
--sleeptime Enable sleeptime memory management (only for new agents)
--from-af <path> Create agent from an AgentFile (.af) template
--memfs Enable memory filesystem for this agent
--no-memfs Disable memory filesystem for this agent
BEHAVIOR
On startup, Letta Code checks for saved profiles:
@@ -409,6 +411,8 @@ async function main(): Promise<void> {
sleeptime: { type: "boolean" },
"from-af": { type: "string" },
"no-skills": { type: "boolean" },
memfs: { type: "boolean" },
"no-memfs": { type: "boolean" },
},
strict: true,
allowPositionals: true,
@@ -518,6 +522,8 @@ async function main(): Promise<void> {
const specifiedToolset = (values.toolset as string | undefined) ?? undefined;
const skillsDirectory = (values.skills as string | undefined) ?? undefined;
const sleeptimeFlag = (values.sleeptime as boolean | undefined) ?? undefined;
const memfsFlag = values.memfs as boolean | undefined;
const noMemfsFlag = values["no-memfs"] as boolean | undefined;
const fromAfFile = values["from-af"] as string | undefined;
const isHeadless = values.prompt || values.run || !process.stdin.isTTY;
@@ -1590,6 +1596,13 @@ async function main(): Promise<void> {
// Set agent context for tools that need it (e.g., Skill tool)
setAgentContext(agent.id, skillsDirectory);
// Apply memfs flag if specified
if (memfsFlag) {
settingsManager.setMemfsEnabled(agent.id, true);
} else if (noMemfsFlag) {
settingsManager.setMemfsEnabled(agent.id, false);
}
// Fire-and-forget: Initialize loaded skills flag (LET-7101)
// Don't await - this is just for the skill unload reminder
initializeLoadedSkillsFlag().catch(() => {