feat(cli): add /recompile slash command (#1412)

Co-authored-by: Letta Code <noreply@letta.com>
This commit is contained in:
Sarah Wooders
2026-03-16 16:50:30 -07:00
committed by GitHub
parent b1930224e7
commit ad7177b305
2 changed files with 52 additions and 0 deletions

View File

@@ -7858,6 +7858,49 @@ export default function App({
return { submitted: true };
}
// Special handling for /recompile command - recompile agent + current conversation
if (trimmed === "/recompile") {
const cmd = commandRunner.start(
trimmed,
"Recompiling agent and conversation...",
);
setCommandRunning(true);
try {
const client = await getClient();
const currentConversationId = conversationIdRef.current;
await client.agents.recompile(agentId, {
update_timestamp: true,
});
const conversationParams =
currentConversationId === "default"
? { agent_id: agentId }
: undefined;
await client.conversations.recompile(
currentConversationId,
conversationParams,
);
cmd.finish(
[
"Recompiled current agent and conversation.",
"(warning: this will evict the cache and increase costs)",
].join("\n"),
true,
);
} catch (error) {
const errorDetails = formatErrorDetails(error, agentId);
cmd.fail(`Failed: ${errorDetails}`);
} finally {
setCommandRunning(false);
}
return { submitted: true };
}
// Special handling for /exit command - exit without stats
if (trimmed === "/exit") {
const cmd = commandRunner.start(trimmed, "See ya!");

View File

@@ -270,6 +270,15 @@ export const commands: Record<string, Command> = {
return "Fetching context usage...";
},
},
"/recompile": {
desc: "Recompile current agent + conversation (warning: this will evict the cache and increase costs)",
order: 33.6,
noArgs: true,
handler: () => {
// Handled specially in App.tsx
return "Recompiling agent and conversation...";
},
},
"/feedback": {
desc: "Send feedback to the Letta team",
order: 34,