Skip to content

🙌 OpenHands: AI-Driven Development

feat: add persistent agent memory toggle (#16097)

Hiep Le0d94bd0b7f93
diff --git a/__tests__/api/agent-server-adapter.test.ts b/__tests__/api/agent-server-adapter.test.ts
index ad52b7b804..b6853837e8 100644
--- a/__tests__/api/agent-server-adapter.test.ts
+++ b/__tests__/api/agent-server-adapter.test.ts
@@ -143,6 +143,11 @@ describe("buildStartConversationRequest", () => {
load_user_skills: true,
load_project_skills: true,
});
+ // Persistent memory is opt-in: the key must be absent (not false) so the
+ // wire payload for un-opted users stays byte-identical to before.
+ expect(payload.agent_settings.agent_context).not.toHaveProperty(
+ "load_memory",
+ );
// Bundled public skills are injected into agent_context.skills so the
// SDK can perform trigger matching without cloning the extensions repo.
expect(Array.isArray(payload.agent_settings.agent_context.skills)).toBe(
@@ -486,6 +491,53 @@ describe("buildStartConversationRequest", () => {
});
});
+ it("passes a stored agent_context.load_memory through on an inline launch", () => {
+ // The persistent-memory toggle persists into
+ // ``agent_settings.agent_context.load_memory``; buildAgentContext spreads
+ // the stored context, so the flag needs no dedicated adapter wiring.
+ //
+ // This is the inline path only. A profile launch sends ``agent_profile_id``
+ // and no ``agent_settings`` at all (pinned in
+ // src/api/agent-server-adapter.test.ts), so there the agent-server reads the
+ // same stored preference itself — covered by the SDK's
+ // tests/agent_server/test_agent_profile_conv_start.py.
+ const payload = buildStartConversationRequest({
+ settings: {
+ ...DEFAULT_SETTINGS,
+ agent_settings: {
+ ...DEFAULT_SETTINGS.agent_settings,
+ agent_context: { load_memory: true },
+ },
+ },
+ }) as {
+ agent_settings: { agent_context: Record<string, unknown> };
+ };
+
+ expect(payload.agent_settings.agent_context.load_memory).toBe(true);
+ });
+
+ it("passes a stored agent_context.load_memory through on an inline ACP launch", () => {
+ // Inline ACP settings are the fallback used when no agent profile is
+ // available; a normal ACP conversation launches from a profile (see
+ // use-create-conversation.test.tsx) and never reaches this branch.
+ const payload = buildStartConversationRequest({
+ settings: {
+ ...DEFAULT_SETTINGS,
+ agent_settings: {
+ ...DEFAULT_SETTINGS.agent_settings,
+ agent_kind: "acp",
+ acp_server: "claude-code",
+ acp_command: ["npx", "-y", "@agentclientprotocol/claude-agent-acp"],
+ agent_context: { load_memory: true },
+ },
+ },
+ }) as {
+ agent_settings: { agent_context: Record<string, unknown> };
+ };
+
+ expect(payload.agent_settings.agent_context.load_memory).toBe(true);
+ });
+
it("does NOT mirror conversation secrets onto agent_context for ACP — request.secrets is the sole channel", () => {
// The compatible agent-server line injects the ACP spawn env from
// ``secret_registry``, which is seeded from ``request.secrets``
diff --git a/__tests__/components/features/settings/sdk-settings/sdk-section-page.test.tsx b/__tests__/components/features/settings/sdk-settings/sdk-section-page.test.tsx
index c0fa2f34ff..ecf7d33699 100644
--- a/__tests__/components/features/settings/sdk-settings/sdk-section-page.test.tsx
+++ b/__tests__/components/features/settings/sdk-settings/sdk-section-page.test.tsx
@@ -85,6 +85,7 @@ function buildSavableSettings(): Settings {
function renderSdkSectionPage(
props: React.ComponentProps<typeof SdkSectionPage>,
+ { strict = false }: { strict?: boolean } = {},
) {
const queryClient = new QueryClient({
defaultOptions: {
@@ -99,9 +100,14 @@ function renderSdkSectionPage(
mockUseSearchParams.mockReturnValue([{ get: () => null }, vi.fn()]);
return render(React.createElement(SdkSectionPage, props), {
- wrapper: ({ children }) => (
- <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
- ),
+ wrapper: ({ children }) => {
+ const tree = (
+ <QueryClientProvider client={queryClient}>
+ {children}
+ </QueryClientProvider>
+ );
+ return strict ? <React.StrictMode>{tree}</React.StrictMode> : tree;
+ },
});
}
@@ -564,6 +570,56 @@ describe("SdkSectionPage", () => {
expect(screen.getByTestId("sdk-section-all-toggle")).toBeInTheDocument();
});
+ it("floors a critical-less schema at advanced under StrictMode", async () => {
+ // StrictMode double-invokes state updaters, so the hydration updater must
+ // stay pure: an impure one takes its already-hydrated branch on the second
+ // (kept) call and pins the page to the empty basic tier (#16097).
+ const schema: NonNullable<Settings["agent_settings_schema"]> = {
+ model_name: "AgentSettings",
+ sections: [
+ {
+ key: "agent_context",
+ label: "Agent Context",
+ fields: [
+ {
+ key: "agent_context.load_memory",
+ label: "Persistent memory",
+ section: "agent_context",
+ section_label: "Agent Context",
+ value_type: "boolean",
+ default: false,
+ choices: [],
+ depends_on: [],
+ prominence: "major",
+ secret: false,
+ required: false,
+ },
+ ],
+ },
+ ],
+ };
+
+ vi.spyOn(SettingsService, "getSettings").mockResolvedValue(
+ buildSettings({
+ agent_settings_schema: schema,
+ agent_settings: { "agent_context.load_memory": false },
+ }),
+ );
+
+ renderSdkSectionPage(
+ {
+ settingsSources: [
+ { settingsSource: "agent_settings", sectionKeys: ["agent_context"] },
+ ],
+ },
+ { strict: true },
+ );
+
+ expect(
+ await screen.findByTestId("sdk-settings-agent_context.load_memory"),
+ ).toBeInTheDocument();
+ });
+
it("renders URL-like schema fields as url inputs", async () => {
const schema: NonNullable<Settings["agent_settings_schema"]> = {
model_name: "AgentSettings",
diff --git a/__tests__/routes/agent-context-settings.test.tsx b/__tests__/routes/agent-context-settings.test.tsx
new file mode 100644
index 0000000000..db092da54f
--- /dev/null
+++ b/__tests__/routes/agent-context-settings.test.tsx
@@ -0,0 +1,133 @@
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { render, screen } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import SettingsService from "#/api/settings-service/settings-service.api";
+import { MOCK_DEFAULT_USER_SETTINGS } from "#/mocks/handlers";
+import AgentContextSettingsScreen from "#/routes/agent-context-settings";
+import { Settings } from "#/types/settings";
+
+function buildSettings(overrides: Partial<Settings> = {}): Settings {
+ return {
+ ...MOCK_DEFAULT_USER_SETTINGS,
+ ...overrides,
+ agent_settings: {
+ ...MOCK_DEFAULT_USER_SETTINGS.agent_settings,
+ ...overrides.agent_settings,
+ },
+ agent_settings_schema:
+ overrides.agent_settings_schema ??
+ MOCK_DEFAULT_USER_SETTINGS.agent_settings_schema,
+ };
+}
+
+function renderAgentContextSettingsScreen() {
+ const queryClient = new QueryClient({
+ defaultOptions: {
+ queries: { retry: false },
+ },
+ });
+
+ return render(<AgentContextSettingsScreen />, {
+ wrapper: ({ children }) => (
+ <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
+ ),
+ });
+}
+
+beforeEach(() => {
+ vi.restoreAllMocks();
+});
+
+describe("AgentContextSettingsScreen", () => {
+ it("renders the persistent-memory toggle from the agent schema, off by default", async () => {
+ vi.spyOn(SettingsService, "getSettings").mockResolvedValue(buildSettings());
+
+ renderAgentContextSettingsScreen();
+
+ await screen.findByTestId("agent-context-settings-screen");
+
+ const toggle = screen.getByTestId("sdk-settings-agent_context.load_memory");
+ expect(toggle).toBeInTheDocument();
+ expect(toggle).not.toBeChecked();
+ });
+
+ it("reflects a stored agent_context.load_memory value", async () => {
+ vi.spyOn(SettingsService, "getSettings").mockResolvedValue(
+ buildSettings({
+ agent_settings: {
+ ...MOCK_DEFAULT_USER_SETTINGS.agent_settings,
+ agent_context: { load_memory: true },
+ },
+ }),
+ );
+
+ renderAgentContextSettingsScreen();
+
+ await screen.findByTestId("agent-context-settings-screen");
+
+ expect(
+ screen.getByTestId("sdk-settings-agent_context.load_memory"),
+ ).toBeChecked();
+ });
+
+ it("saves the toggle as a nested agent_settings_diff", async () => {
+ const user = userEvent.setup();
+ vi.spyOn(SettingsService, "getSettings").mockResolvedValue(buildSettings());
+ const saveSettingsSpy = vi
+ .spyOn(SettingsService, "saveSettings")
+ .mockResolvedValue(true);
+
+ renderAgentContextSettingsScreen();
+
+ await screen.findByTestId("agent-context-settings-screen");
+ await user.click(
+ screen.getByTestId("sdk-settings-agent_context.load_memory"),
+ );
+ await user.click(screen.getByTestId("save-button"));
+
+ expect(saveSettingsSpy).toHaveBeenCalledWith(
+ expect.objectContaining({
+ agent_settings_diff: { agent_context: { load_memory: true } },
+ }),
+ );
+ });
+
+ it("shows the toggle without a dead Basic tab (major-only section)", async () => {
+ vi.spyOn(SettingsService, "getSettings").mockResolvedValue(buildSettings());
+
+ renderAgentContextSettingsScreen();
+
+ await screen.findByTestId("agent-context-settings-screen");
+
+ // The section's only field is major-prominence: the page floors its
+ // initial view at "advanced" and hides the view toggle entirely (a
+ // Basic tab would render an empty page).
+ expect(
+ screen.getByTestId("sdk-settings-agent_context.load_memory"),
+ ).toBeInTheDocument();
+ expect(
+ screen.queryByTestId("sdk-section-basic-toggle"),
+ ).not.toBeInTheDocument();
+ });
+
+ it("shows the schema-unavailable state when the server does not expose the section", async () => {
+ const schemaWithoutAgentContext = structuredClone(
+ MOCK_DEFAULT_USER_SETTINGS.agent_settings_schema!,
+ );
+ schemaWithoutAgentContext.sections =
+ schemaWithoutAgentContext.sections.filter(
+ (section) => section.key !== "agent_context",
+ );
+ vi.spyOn(SettingsService, "getSettings").mockResolvedValue(
+ buildSettings({ agent_settings_schema: schemaWithoutAgentContext }),
+ );
+
+ renderAgentContextSettingsScreen();
+
+ expect(await screen.findByTestId("sdk-schema-unavailable")).toBeVisible();
+ expect(
+ screen.queryByTestId("sdk-settings-agent_context.load_memory"),
+ ).not.toBeInTheDocument();
+ });
+});
diff --git a/src/api/agent-server-adapter.ts b/src/api/agent-server-adapter.ts
index bedabffabc..0755068102 100644
--- a/src/api/agent-server-adapter.ts
+++ b/src/api/agent-server-adapter.ts
@@ -976,6 +976,14 @@ export function buildStartConversationRequest(
// Finish/Think). The dev ``RUNTIME_SERVICES`` system-message suffix remains
// agent-settings-only; the Canvas UI tool is a top-level client tool and
// therefore works on both inline-agent and profile launch paths.
+ //
+ // Persistent memory is NOT on that boundary: ``load_memory`` is a global
+ // user preference, so the agent-server stamps the stored
+ // ``agent_settings.agent_context.load_memory`` onto the profile-resolved
+ // agent the same way it already applies the global ``mcp_config``. The
+ // toggle therefore applies to both launch paths, and the client must not
+ // re-send it here (``agent_profile_id`` and ``agent_settings`` are
+ // mutually exclusive).
...(options.agentProfileId
? { agent_profile_id: options.agentProfileId }
: { agent_settings: agentSettings }),
diff --git a/src/components/features/settings/sdk-settings/sdk-section-page.tsx b/src/components/features/settings/sdk-settings/sdk-section-page.tsx
index d870609f4a..4d4f755b35 100644
--- a/src/components/features/settings/sdk-settings/sdk-section-page.tsx
+++ b/src/components/features/settings/sdk-settings/sdk-section-page.tsx
@@ -23,6 +23,7 @@ import {
buildSdkSettingsPayloadForView,
getVisibleSettingsSections,
hasAdvancedSettings,
+ hasCriticalSettings,
hasMinorSettings,
inferInitialView,
isValidSettingsSchema,
@@ -57,9 +58,11 @@ const getMoreDetailedView = (
const normalizeView = (
view: SettingsView,
{
+ showBasic,
showAdvanced,
showAll,
}: {
+ showBasic: boolean;
showAdvanced: boolean;
showAll: boolean;
},
@@ -80,6 +83,11 @@ const normalizeView = (
return showAll ? "all" : "basic";
}
+ // A critical-less page has nothing to render in the basic tier; bump up.
+ if (!showBasic) {
+ if (showAdvanced) return "advanced";
+ if (showAll) return "all";
+ }
return "basic";
};
@@ -300,6 +308,12 @@ export function SdkSectionPage({
[resolvedSourceConfigs, getSchemaForSource],
);
+ // The basic tier only exists when some field renders in it; a critical-less
+ // page (e.g. Memory, whose only field is major) hides the Basic tab and
+ // floors its view at "advanced".
+ const showBasic = resolvedSources.some((src) =>
+ hasCriticalSettings(src.filteredSchema),
+ );
const showAdvanced =
forceShowAdvancedView ||
resolvedSources.some((src) => hasAdvancedSettings(src.filteredSchema));
@@ -380,8 +394,15 @@ export function SdkSectionPage({
result = result ? getMoreDetailedView(result, perSource) : perSource;
}
if (!result) return null;
- return normalizeView(result, { showAdvanced, showAll });
- }, [settings, resolvedSources, getInitialView, showAdvanced, showAll]);
+ return normalizeView(result, { showBasic, showAdvanced, showAll });
+ }, [
+ settings,
+ resolvedSources,
+ getInitialView,
+ showBasic,
+ showAdvanced,
+ showAll,
+ ]);
React.useEffect(() => {
hasHydratedViewRef.current = false;
@@ -407,14 +428,15 @@ export function SdkSectionPage({
} else {
setDirtyBySource({});
}
- setView((currentView) => {
- if (!hasHydratedViewRef.current) {
- hasHydratedViewRef.current = true;
- return initialView;
- }
-
- return getLessDetailedView(currentView, initialView);
- });
+ // The ref flip stays outside the updater: React double-invokes state
+ // updaters in StrictMode, so mutating it in there makes the second
+ // (kept) call take the already-hydrated branch and pin the view.
+ if (!hasHydratedViewRef.current) {
+ hasHydratedViewRef.current = true;
+ setView(initialView);
+ } else {
+ setView((currentView) => getLessDetailedView(currentView, initialView));
+ }
}, [initialValuesBySource, initialView]);
const fieldKeyToSource = React.useMemo(() => {
@@ -630,6 +652,7 @@ export function SdkSectionPage({
<ViewToggle
view={view}
setView={setView}
+ showBasic={showBasic}
showAdvanced={showAdvanced}
showAll={showAll}
isDisabled={isReadOnly}
diff --git a/src/components/features/settings/sdk-settings/view-toggle.tsx b/src/components/features/settings/sdk-settings/view-toggle.tsx
index 83a9dbe45e..38d1a2f9f9 100644
--- a/src/components/features/settings/sdk-settings/view-toggle.tsx
+++ b/src/components/features/settings/sdk-settings/view-toggle.tsx
@@ -7,6 +7,8 @@ import { formControlTransitionClassName } from "#/utils/form-control-classes";
interface ViewToggleProps {
view: SettingsView;
setView: (view: SettingsView) => void;
+ /** Whether the basic tier has anything to show (any critical fields). */
+ showBasic?: boolean;
showAdvanced: boolean;
showAll: boolean;
isDisabled?: boolean;
@@ -26,13 +28,15 @@ const tabButtonClass = (isActive: boolean, isDisabled: boolean) =>
export function ViewToggle({
view,
setView,
+ showBasic = true,
showAdvanced,
showAll,
isDisabled = false,
}: ViewToggleProps) {
const { t } = useTranslation("openhands");
- if (!showAdvanced && !showAll) return null;
+ const visibleTabs = [showBasic, showAdvanced, showAll].filter(Boolean).length;
+ if (visibleTabs <= 1) return null;
return (
<div
@@ -40,17 +44,19 @@ export function ViewToggle({
aria-orientation="horizontal"
className="mb-6 flex items-center gap-2"
>
- <button
- data-testid="sdk-section-basic-toggle"
- type="button"
- role="tab"
- aria-selected={view === "basic"}
- disabled={isDisabled}
- className={tabButtonClass(view === "basic", isDisabled)}
- onClick={() => setView("basic")}
- >
- {t(I18nKey.SETTINGS$BASIC)}
- </button>
+ {showBasic ? (
+ <button
+ data-testid="sdk-section-basic-toggle"
+ type="button"
+ role="tab"
+ aria-selected={view === "basic"}
+ disabled={isDisabled}
+ className={tabButtonClass(view === "basic", isDisabled)}
+ onClick={() => setView("basic")}
+ >
+ {t(I18nKey.SETTINGS$BASIC)}
+ </button>
+ ) : null}
{showAdvanced ? (
<button
data-testid="sdk-section-advanced-toggle"
diff --git a/src/constants/settings-nav.tsx b/src/constants/settings-nav.tsx
index b0de883ae7..aeb4ebc730 100644
--- a/src/constants/settings-nav.tsx
+++ b/src/constants/settings-nav.tsx
@@ -1,4 +1,4 @@
-import { AppWindow, Shield } from "lucide-react";
+import { AppWindow, Brain, Shield } from "lucide-react";
import KeyIcon from "#/icons/key.svg?react";
import MemoryIcon from "#/icons/memory_icon.svg?react";
import CircuitIcon from "#/icons/u-circuit.svg?react";
@@ -35,6 +35,18 @@ export const OSS_NAV_ITEMS: SettingsNavItem[] = [
text: "SETTINGS$NAV_CONDENSER",
subtitle: "SETTINGS$PAGE_CONDENSER_SUBLINE",
},
+ {
+ // The agent's ``agent_context`` section, whatever the schema exposes in it
+ // — today only persistent memory (``agent_context.load_memory``). Not
+ // ``disabledByAcp``: the stored flag rides the shared agent_settings
+ // record into ACP conversations too — inline launches spread it into
+ // ``agent_context``, and profile launches (the normal ACP path) have the
+ // agent-server stamp it onto the profile-resolved agent.
+ icon: <Brain className="size-4" strokeWidth={2} aria-hidden />,
+ to: "/settings/agent-context",
+ text: "SETTINGS$NAV_AGENT_CONTEXT",
+ subtitle: "SETTINGS$PAGE_AGENT_CONTEXT_SUBLINE",
+ },
{
icon: <Shield className="size-4" strokeWidth={2} aria-hidden />,
to: "/settings/verification",
diff --git a/src/i18n/translation.json b/src/i18n/translation.json
index 03a8e18dfd..54d3655ce5 100644
--- a/src/i18n/translation.json
+++ b/src/i18n/translation.json
@@ -2770,6 +2770,57 @@
"uk": "Увімкнути субагентів",
"ca": "Activa subagents"
},
+ "SCHEMA$AGENT_CONTEXT$SECTION_LABEL": {
+ "en": "Agent Context",
+ "ja": "エージェントコンテキスト",
+ "zh-CN": "代理上下文",
+ "zh-TW": "代理上下文",
+ "ko-KR": "에이전트 컨텍스트",
+ "de": "Agentenkontext",
+ "no": "Agentkontekst",
+ "it": "Contesto dell'agente",
+ "pt": "Contexto do agente",
+ "es": "Contexto del agente",
+ "ar": "سياق الوكيل",
+ "fr": "Contexte de l'agent",
+ "tr": "Ajan Bağlamı",
+ "uk": "Контекст агента",
+ "ca": "Context de l'agent"
+ },
+ "SCHEMA$AGENT_CONTEXT$LOAD_MEMORY$LABEL": {
+ "en": "Persistent Agent Memory",
+ "ja": "永続エージェントメモリ",
+ "zh-CN": "持久代理记忆",
+ "zh-TW": "持久代理記憶",
+ "ko-KR": "지속 에이전트 메모리",
+ "de": "Persistentes Agenten-Gedächtnis",
+ "no": "Vedvarende agentminne",
+ "it": "Memoria persistente dell'agente",
+ "pt": "Memória persistente do agente",
+ "es": "Memoria persistente del agente",
+ "ar": "ذاكرة الوكيل الدائمة",
+ "fr": "Mémoire persistante de l'agent",
+ "tr": "Kalıcı Ajan Belleği",
+ "uk": "Постійна пам'ять агента",
+ "ca": "Memòria persistent de l'agent"
+ },
+ "SCHEMA$AGENT_CONTEXT$LOAD_MEMORY$DESCRIPTION": {
+ "en": "The agent keeps notes under .openhands/memory/ and loads them at the start of each new conversation, learning your codebase and preferences over time.",
+ "ja": "エージェントは .openhands/memory/ にメモを保存し、新しい会話の開始時に読み込みます。時間とともにコードベースや好みを学習します。",
+ "zh-CN": "代理会在 .openhands/memory/ 下保存笔记,并在每次新会话开始时加载它们,随着时间推移学习您的代码库和偏好。",
+ "zh-TW": "代理會在 .openhands/memory/ 下保存筆記,並在每次新會話開始時載入它們,隨著時間推移學習您的程式碼庫和偏好。",
+ "ko-KR": "에이전트는 .openhands/memory/ 아래에 메모를 저장하고 새 대화를 시작할 때마다 불러오며, 시간이 지남에 따라 코드베이스와 선호도를 학습합니다.",
+ "de": "Der Agent speichert Notizen unter .openhands/memory/ und lädt sie zu Beginn jeder neuen Konversation. So lernt er Ihre Codebasis und Vorlieben mit der Zeit kennen.",
+ "no": "Agenten lagrer notater under .openhands/memory/ og laster dem inn ved starten av hver nye samtale, og lærer kodebasen og preferansene dine over tid.",
+ "it": "L'agente conserva appunti in .openhands/memory/ e li carica all'inizio di ogni nuova conversazione, imparando nel tempo la tua codebase e le tue preferenze.",
+ "pt": "O agente guarda notas em .openhands/memory/ e carrega-as no início de cada nova conversa, aprendendo a sua base de código e preferências ao longo do tempo.",
+ "es": "El agente guarda notas en .openhands/memory/ y las carga al inicio de cada nueva conversación, aprendiendo tu base de código y tus preferencias con el tiempo.",
+ "ar": "يحتفظ الوكيل بملاحظات ضمن .openhands/memory/ ويحمّلها في بداية كل محادثة جديدة، فيتعلم قاعدة التعليمات البرمجية وتفضيلاتك بمرور الوقت.",
+ "fr": "L'agent conserve des notes dans .openhands/memory/ et les charge au début de chaque nouvelle conversation, apprenant votre base de code et vos préférences au fil du temps.",
+ "tr": "Ajan, .openhands/memory/ altında notlar tutar ve her yeni konuşmanın başında bunları yükler; zamanla kod tabanınızı ve tercihlerinizi öğrenir.",
+ "uk": "Агент зберігає нотатки в .openhands/memory/ і завантажує їх на початку кожної нової розмови, з часом вивчаючи вашу кодову базу та вподобання.",
+ "ca": "L'agent desa notes a .openhands/memory/ i les carrega a l'inici de cada nova conversa, aprenent amb el temps la teva base de codi i les teves preferències."
+ },
"SCHEMA$CONDENSER$ENABLED$DESCRIPTION": {
"en": "Enable the LLM summarizing condenser.",
"ja": "LLM要約コンデンサーを有効にします。",
@@ -5643,6 +5694,23 @@
"uk": "Конденсатор",
"ca": "Condensador"
},
+ "SETTINGS$NAV_AGENT_CONTEXT": {
+ "en": "Agent Context",
+ "ja": "エージェントコンテキスト",
+ "zh-CN": "代理上下文",
+ "zh-TW": "代理上下文",
+ "ko-KR": "에이전트 컨텍스트",
+ "de": "Agentenkontext",
+ "no": "Agentkontekst",
+ "it": "Contesto dell'agente",
+ "pt": "Contexto do agente",
+ "es": "Contexto del agente",
+ "ar": "سياق الوكيل",
+ "fr": "Contexte de l'agent",
+ "tr": "Ajan Bağlamı",
+ "uk": "Контекст агента",
+ "ca": "Context de l'agent"
+ },
"SETTINGS$NAV_LLM": {
"en": "LLM",
"ja": "LLM",
@@ -5966,6 +6034,23 @@
"uk": "Стискайте довгі розмови, щоб залишатися в межах контексту.",
"ca": "Resumeix converses llargues per mantenir-te dins dels límits de context."
},
+ "SETTINGS$PAGE_AGENT_CONTEXT_SUBLINE": {
+ "en": "Let the agent keep notes and recall them in new conversations.",
+ "ja": "エージェントがメモを保存し、新しい会話で思い出せるようにします。",
+ "zh-CN": "让代理保存笔记并在新对话中回忆起来。",
+ "zh-TW": "讓代理保存筆記並在新對話中回憶起來。",
+ "ko-KR": "에이전트가 메모를 저장하고 새 대화에서 기억하도록 합니다.",
+ "de": "Lässt den Agenten Notizen führen und sie in neuen Konversationen abrufen.",
+ "no": "La agenten lagre notater og hente dem frem i nye samtaler.",
+ "it": "Consenti all'agente di prendere appunti e richiamarli nelle nuove conversazioni.",
+ "pt": "Permita que o agente guarde notas e as recorde em novas conversas.",
+ "es": "Permite que el agente guarde notas y las recuerde en nuevas conversaciones.",
+ "ar": "دَع الوكيل يحتفظ بالملاحظات ويستعيدها في المحادثات الجديدة.",
+ "fr": "Laissez l'agent conserver des notes et les rappeler dans les nouvelles conversations.",
+ "tr": "Ajanın not tutmasına ve yeni konuşmalarda bunları hatırlamasına izin verin.",
+ "uk": "Дозвольте агенту вести нотатки та згадувати їх у нових розмовах.",
+ "ca": "Permet que l'agent desi notes i les recordi en converses noves."
+ },
"SETTINGS$PAGE_VERIFICATION_SUBLINE": {
"en": "Confirmation prompts and security checks on actions.",
"ja": "アクションに対する確認プロンプトとセキュリティチェック。",
diff --git a/src/mocks/settings-handlers.ts b/src/mocks/settings-handlers.ts
index afae918b53..d355003af2 100644
--- a/src/mocks/settings-handlers.ts
+++ b/src/mocks/settings-handlers.ts
@@ -345,6 +345,31 @@ const MOCK_AGENT_SETTINGS_SCHEMA: NonNullable<
},
],
},
+ {
+ // Curated agent_context section (SDK fields_opt_in): only load_memory
+ // is exposed, never the raw AgentContext model. ``label`` mirrors the
+ // server's literal string ("Memory"); the GUI names the page itself via
+ // the SCHEMA$AGENT_CONTEXT$SECTION_LABEL translation, which wins.
+ key: "agent_context",
+ label: "Memory",
+ fields: [
+ {
+ description:
+ "The agent keeps notes under .openhands/memory/ and loads them at the start of each new conversation, learning your codebase and preferences over time.",
+ key: "agent_context.load_memory",
+ label: "Persistent memory",
+ section: "agent_context",
+ section_label: "Memory",
+ value_type: "boolean",
+ default: false,
+ choices: [],
+ depends_on: [],
+ prominence: "major",
+ secret: false,
+ required: false,
+ },
+ ],
+ },
],
};
diff --git a/src/routes.ts b/src/routes.ts
index a14ef8860d..dbab4ee202 100644
--- a/src/routes.ts
+++ b/src/routes.ts
@@ -25,6 +25,7 @@ export default [
route("agent", "routes/agent-settings.tsx"),
route("agents", "routes/agent-profiles-settings.tsx"),
route("condenser", "routes/condenser-settings.tsx"),
+ route("agent-context", "routes/agent-context-settings.tsx"),
route("verification", "routes/verification-settings.tsx"),
route("app", "routes/app-settings.tsx"),
route("secrets", "routes/secrets-settings.tsx"),
diff --git a/src/routes/agent-context-settings.tsx b/src/routes/agent-context-settings.tsx
new file mode 100644
index 0000000000..ce9623e656
--- /dev/null
+++ b/src/routes/agent-context-settings.tsx
@@ -0,0 +1,14 @@
+import { SdkSectionPage } from "#/components/features/settings/sdk-settings/sdk-section-page";
+
+function AgentContextSettingsScreen() {
+ return (
+ <SdkSectionPage
+ settingsSources={[
+ { settingsSource: "agent_settings", sectionKeys: ["agent_context"] },
+ ]}
+ testId="agent-context-settings-screen"
+ />
+ );
+}
+
+export default AgentContextSettingsScreen;
diff --git a/src/utils/sdk-settings-schema.ts b/src/utils/sdk-settings-schema.ts
index dad46b494a..19a9cd2475 100644
--- a/src/utils/sdk-settings-schema.ts
+++ b/src/utils/sdk-settings-schema.ts
@@ -473,6 +473,12 @@ export function getVisibleSettingsSections(
.filter((section) => section.fields.length > 0);
}
+/** Whether the schema has any "critical" prominence fields (the basic tier). */
+export function hasCriticalSettings(schema: SettingsSchema | null): boolean {
+ if (!schema) return false;
+ return getSchemaFields(schema).some((f) => f.prominence === "critical");
+}
+
/** Whether the schema has any fields visible in the "advanced" tier. */
export function hasAdvancedSettings(schema: SettingsSchema | null): boolean {
if (!schema) return false;