diff --git a/README.md b/README.md index bd93e2a..48bf4cc 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ import { createAgent, resumeSession } from "@letta-ai/letta-code-sdk"; const agentId = await createAgent({ persona: "You are a helpful coding assistant for TypeScript projects.", + memfs: true, // Enable git-backed memory filesystem for this new agent }); await using session = resumeSession(agentId); diff --git a/src/transport.test.ts b/src/transport.test.ts index 20218ce..f5ae948 100644 --- a/src/transport.test.ts +++ b/src/transport.test.ts @@ -30,6 +30,7 @@ describe("transport args", () => { permissionMode?: "default" | "acceptEdits" | "plan" | "bypassPermissions"; allowedTools?: string[]; disallowedTools?: string[]; + memfs?: boolean; } = {}): string[] { const transport = new SubprocessTransport(options); // Access private helper for deterministic argument testing. @@ -66,4 +67,14 @@ describe("transport args", () => { expect(args).toContain("--disallowedTools"); expect(args).toContain("EnterPlanMode,ExitPlanMode"); }); + + test("memfs true forwards --memfs", () => { + const args = buildArgsFor({ memfs: true }); + expect(args).toContain("--memfs"); + }); + + test("memfs false/undefined does not forward --memfs", () => { + expect(buildArgsFor({ memfs: false })).not.toContain("--memfs"); + expect(buildArgsFor({})).not.toContain("--memfs"); + }); }); diff --git a/src/transport.ts b/src/transport.ts index 396bbe9..3dd4b3e 100644 --- a/src/transport.ts +++ b/src/transport.ts @@ -367,6 +367,11 @@ export class SubprocessTransport { args.push("--tags", this.options.tags.join(",")); } + // Memory filesystem + if (this.options.memfs) { + args.push("--memfs"); + } + return args; } diff --git a/src/types.ts b/src/types.ts index 6f67fea..ac9cc72 100644 --- a/src/types.ts +++ b/src/types.ts @@ -211,6 +211,9 @@ export interface InternalSessionOptions { // Tags (only for new agents) tags?: string[]; + // Memory filesystem (only for new agents) + memfs?: boolean; + // Permissions allowedTools?: string[]; disallowedTools?: string[]; @@ -318,6 +321,12 @@ export interface CreateAgentOptions { /** Tags to organize and categorize the agent */ tags?: string[]; + + /** + * Enable git-backed memory filesystem for this newly created agent. + * Maps to Letta Code CLI `--memfs` during agent creation. + */ + memfs?: boolean; } // ═══════════════════════════════════════════════════════════════