Skip to content

Commit 02c25cd

Browse files
committed
feat: add global memory defaults with per-expert overrides
1 parent 976803d commit 02c25cd

26 files changed

Lines changed: 2487 additions & 73 deletions

‎dashboard/src/api/modules/memoryDashboard.ts‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,24 @@ export interface ListRawEventsBody {
102102
}
103103

104104
export type ExtractTriggerMode = "idle" | "interval";
105+
export type MemoryOverrideMode = "inherit" | "custom";
106+
107+
export interface GlobalMemoryDefaults {
108+
aux_model: string | null;
109+
aux_model_usable?: boolean;
110+
extract_keep_rules: string;
111+
extract_skip_rules: string;
112+
supported_call_options?: string[];
113+
affected_agent_count?: number;
114+
}
115+
116+
export interface EffectiveMemoryExtractConfig {
117+
aux_model: string | null;
118+
aux_model_configured?: string | null;
119+
aux_model_usable?: boolean;
120+
extract_keep_rules: string;
121+
extract_skip_rules: string;
122+
}
105123

106124
export interface ExtractConfig {
107125
/** Missing on older Octop API processes; absence keeps the historical enabled default. */
@@ -110,11 +128,21 @@ export interface ExtractConfig {
110128
extract_trigger_mode: ExtractTriggerMode;
111129
extract_idle_seconds: number;
112130
extract_interval_seconds: number;
131+
/** Whether extraction model inherits global defaults or uses an expert override. */
132+
aux_model_mode?: MemoryOverrideMode;
113133
/**
114134
* "provider/model" ref used for extraction / promotion. null/absent = AUTO
115135
* (follow the chat model); send "" to reset back to AUTO.
116136
*/
117137
aux_model?: string | null;
138+
/** Whether memory keep/skip rules inherit global defaults or use an expert override. */
139+
extract_rules_mode?: MemoryOverrideMode;
140+
extract_keep_rules?: string;
141+
extract_skip_rules?: string;
142+
/** Read-only global default summary for display in the expert settings UI. */
143+
global_defaults?: GlobalMemoryDefaults;
144+
/** Read-only effective values resolved from expert override + global defaults. */
145+
effective?: EffectiveMemoryExtractConfig;
118146
/**
119147
* Read timeout (seconds) for light memory calls (extraction). null/absent =
120148
* harness default (120s); send 0 to reset back to the default.
@@ -739,6 +767,23 @@ export const memoryDashboardApi = {
739767
method: "PUT",
740768
body: JSON.stringify(body),
741769
}),
770+
771+
// global default memory settings (Admin → Memory)
772+
getGlobalMemoryDefaults: () =>
773+
request<GlobalMemoryDefaults>("/settings/memory-defaults"),
774+
775+
putGlobalMemoryDefaults: (
776+
body: Partial<
777+
Pick<
778+
GlobalMemoryDefaults,
779+
"aux_model" | "extract_keep_rules" | "extract_skip_rules"
780+
>
781+
>,
782+
) =>
783+
request<GlobalMemoryDefaults>("/settings/memory-defaults", {
784+
method: "PUT",
785+
body: JSON.stringify(body),
786+
}),
742787
};
743788

744789
export default memoryDashboardApi;

‎dashboard/src/layouts/sidebarNav.tsx‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
Link2,
99
Database,
1010
Cpu,
11+
Brain,
1112
Users as UsersIcon,
1213
Activity,
1314
Share2,
@@ -80,6 +81,7 @@ export const SIDEBAR_NAV_KEYS = [
8081
"acp",
8182
"admin-users",
8283
"models",
84+
"admin-memory",
8385
"admin-storage",
8486
"admin-plugins",
8587
"admin-security",
@@ -134,6 +136,7 @@ export const SIDEBAR_GROUPED_NAV_KEYS = [
134136
"acp",
135137
"admin-users",
136138
"models",
139+
"admin-memory",
137140
"admin-storage",
138141
"admin-plugins",
139142
"admin-security",
@@ -297,6 +300,14 @@ export function buildNavSections(
297300
labelKey: "nav.models",
298301
});
299302
}
303+
if (navAllowed(user, "admin-memory")) {
304+
adminItems.push({
305+
key: "admin-memory",
306+
path: "/admin/memory",
307+
icon: <Brain size={iconSize} strokeWidth={iconStroke} />,
308+
labelKey: "nav.adminMemory",
309+
});
310+
}
300311
if (navAllowed(user, "admin-storage")) {
301312
adminItems.push({
302313
key: "admin-storage",

‎dashboard/src/locales/en.json‎

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@
327327
"admin": "Admin",
328328
"adminUsers": "User Management",
329329
"adminSso": "Single sign-on",
330+
"adminMemory": "Memory Settings",
330331
"adminStorage": "Storage Management",
331332
"adminAudit": "Audit log",
332333
"adminAgents": "Agents",
@@ -5034,8 +5035,27 @@
50345035
"distillTitle": "Distillation timing",
50355036
"distillDescription": "Choose when conversation material is organized into recallable long-term memory.",
50365037
"extractModelTitle": "Extraction model",
5037-
"extractModelDescription": "The model used to distill memories. \"Auto\" follows the chat default model; you can also pin a cheaper or faster model for extraction.",
5038+
"extractModelDescription": "The model used to distill memories. Inherits global defaults by default, or override per expert to pin a model or follow this expert's chat model.",
50385039
"extractModelAuto": "Auto (follow chat model)",
5040+
"extractModelSource": "Extraction model source",
5041+
"inheritGlobal": "Inherit global",
5042+
"customOverride": "Custom",
5043+
"restoreInherit": "Restore global inheritance",
5044+
"manageGlobalMemory": "Manage global defaults",
5045+
"inheritModelValue": "Inheriting global default: {{model}}",
5046+
"inheritModelUnavailable": "Inheriting global default: {{model}} (currently unavailable; falling back to this expert's chat model)",
5047+
"inheritModelUnset": "Inheriting global default: Not set (follows this expert's chat model)",
5048+
"rulesTitle": "Memory rules",
5049+
"rulesDescription": "Define what information is worth keeping as long-term memory and what should be skipped. Inherits global rules by default, or override per expert.",
5050+
"rulesSource": "Memory rules source",
5051+
"rulesUnsupported": "Rules are saved and will take effect when both octop-harness and octop-memory support custom memory rules.",
5052+
"inheritRulesUnset": "Inheriting global default: No custom rules configured (uses built-in defaults)",
5053+
"keepRulesLabel": "Information worth keeping as long-term memory",
5054+
"keepRulesHint": "For example: domain-specific decisions, stable preferences, client constraints, and reusable context.",
5055+
"keepRulesPlaceholder": "Describe what should be prioritized for long-term memory (leave blank for built-in defaults)",
5056+
"skipRulesLabel": "Information to skip",
5057+
"skipRulesHint": "For example: draft notes, one-off questions, or transient context not worth keeping.",
5058+
"skipRulesPlaceholder": "Describe what should be ignored during extraction (leave blank for built-in defaults)",
50395059
"reloadHint": "Saving reloads the agent automatically. Current conversations are retained.",
50405060
"loadFailed": "Failed to load memory settings",
50415061
"saved": "Saved — the agent will reload automatically",
@@ -8146,5 +8166,27 @@
81468166
"nameRequired": "Enter a name first",
81478167
"failed": "Polish failed. Please try again later.",
81488168
"emptyResult": "The model returned an empty result"
8169+
},
8170+
"adminMemory": {
8171+
"title": "Global Memory Settings",
8172+
"subtitle": "Configure the default memory extraction model and memory rules for new and uncustomized experts. Experts can override each independently while memory data stays isolated per expert.",
8173+
"loadFailed": "Failed to load global memory defaults",
8174+
"saved": "Global memory defaults saved",
8175+
"savedWithAffected": "Saved global memory settings. This change affects {{count}} inheriting experts.",
8176+
"saveFailed": "Failed to save global memory defaults",
8177+
"extractModelTitle": "Default extraction model",
8178+
"extractModelDescription": "Used in the background by all experts set to \"Inherit global\". When unset, each expert follows its own chat model.",
8179+
"extractModelUnset": "Not set (follow each expert's chat model)",
8180+
"extractModelUnavailable": "The configured global extraction model is currently unavailable (its provider may be disabled or removed). Inheriting experts have fallen back to their chat models. Choose an enabled model or clear the default.",
8181+
"rulesTitle": "Default memory rules",
8182+
"rulesDescription": "Define what information is worth retaining as long-term memory and what should be skipped. Leave blank to keep built-in defaults.",
8183+
"rulesUnsupported": "Rules are saved and will take effect when both octop-harness and octop-memory support custom memory rules.",
8184+
"keepRulesLabel": "Information worth keeping as long-term memory",
8185+
"keepRulesHint": "For example: stable user preferences, long-term project decisions, and recurring collaboration context.",
8186+
"keepRulesPlaceholder": "Describe what should be prioritized for long-term memory (leave blank for built-in defaults)",
8187+
"skipRulesLabel": "Information to skip",
8188+
"skipRulesHint": "For example: one-off queries, casual small talk, temporary drafts, or noisy debugging output.",
8189+
"skipRulesPlaceholder": "Describe what should be skipped during extraction (leave blank for built-in defaults)",
8190+
"saveHint": "Saving applies immediately to experts set to \"Inherit global\" without affecting experts with custom overrides."
81498191
}
81508192
}

‎dashboard/src/locales/zh.json‎

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@
327327
"admin": "管理",
328328
"adminUsers": "用户管理",
329329
"adminSso": "单点登录",
330+
"adminMemory": "记忆设置",
330331
"adminStorage": "存储管理",
331332
"adminAudit": "审计日志",
332333
"adminAgents": "智能体",
@@ -4957,8 +4958,27 @@
49574958
"distillTitle": "记忆提炼时机",
49584959
"distillDescription": "选择何时把对话记忆整理为可召回的长期记忆。",
49594960
"extractModelTitle": "记忆提取模型",
4960-
"extractModelDescription": "提炼记忆时调用的模型。选择“自动”跟随对话使用的默认模型;也可以指定一个更便宜或更快的模型专门做提炼。",
4961+
"extractModelDescription": "提炼记忆时调用的模型。默认继承全局设置,也可为当前专家单独指定模型或跟随其对话模型。",
49614962
"extractModelAuto": "自动(跟随对话模型)",
4963+
"extractModelSource": "记忆提取模型来源",
4964+
"inheritGlobal": "继承全局",
4965+
"customOverride": "自定义",
4966+
"restoreInherit": "恢复继承全局",
4967+
"manageGlobalMemory": "管理全局默认",
4968+
"inheritModelValue": "当前继承全局:{{model}}",
4969+
"inheritModelUnavailable": "当前继承全局:{{model}}(该模型当前不可用,已自动回退到本专家对话模型)",
4970+
"inheritModelUnset": "当前继承全局:未设置(沿用本专家对话模型)",
4971+
"rulesTitle": "记忆规则",
4972+
"rulesDescription": "定义哪些信息值得保留为长期记忆、哪些信息应跳过。默认继承全局规则,也可为当前专家单独覆盖。",
4973+
"rulesSource": "记忆规则来源",
4974+
"rulesUnsupported": "当前运行环境尚不支持自定义记忆规则。规则会保存,升级 octop-harness 和 octop-memory 后生效。",
4975+
"inheritRulesUnset": "当前继承全局:未设置自定义规则(沿用内置默认策略)",
4976+
"keepRulesLabel": "值得保留为长期记忆的信息",
4977+
"keepRulesHint": "例如:该专家专属领域的长期决策、客户约束、偏好与后续必用信息。",
4978+
"keepRulesPlaceholder": "描述需要优先记住的信息,留空表示不额外指定",
4979+
"skipRulesLabel": "应当跳过的信息",
4980+
"skipRulesHint": "例如:临时草稿、一次性问答或无需长期留存的上下文。",
4981+
"skipRulesPlaceholder": "描述应跳过的信息,留空表示不额外指定",
49624982
"reloadHint": "保存后专家会自动重载,当前对话不会被删除。",
49634983
"loadFailed": "记忆设置加载失败",
49644984
"saved": "已保存,专家将自动重载",
@@ -8146,5 +8166,27 @@
81468166
"nameRequired": "请先填写名称",
81478167
"failed": "润色失败,请稍后重试",
81488168
"emptyResult": "模型未返回结果"
8169+
},
8170+
"adminMemory": {
8171+
"title": "全局记忆设置",
8172+
"subtitle": "统一配置新建专家与未单独设置专家的默认记忆提取模型和记忆规则;专家可在各自记忆设置中单独覆盖。记忆内容仍按专家隔离。",
8173+
"loadFailed": "全局记忆默认设置加载失败",
8174+
"saved": "已保存全局记忆设置",
8175+
"savedWithAffected": "已保存全局记忆设置,此次变更影响 {{count}} 个继承设置的专家",
8176+
"saveFailed": "保存全局记忆设置失败",
8177+
"extractModelTitle": "默认记忆提取模型",
8178+
"extractModelDescription": "所有选择「继承全局」的专家将统一使用该模型在后台提取记忆;未设置时沿用各专家自己的对话模型。",
8179+
"extractModelUnset": "未设置(沿用各专家对话模型)",
8180+
"extractModelUnavailable": "当前配置的全局提取模型不可用(对应服务商可能已禁用或删除),继承该配置的专家已自动回退到各自对话模型。请重新选择可用模型或恢复未设置。",
8181+
"rulesTitle": "默认记忆规则",
8182+
"rulesDescription": "定义哪些信息值得保留为长期记忆、哪些信息应跳过。留空时沿用内置默认规则。",
8183+
"rulesUnsupported": "当前运行环境尚不支持自定义记忆规则。规则会保存,升级 octop-harness 和 octop-memory 后生效。",
8184+
"keepRulesLabel": "值得保留为长期记忆的信息",
8185+
"keepRulesHint": "例如:稳定的个人偏好、长期项目架构决策、后续协作会反复用到的约定与背景。",
8186+
"keepRulesPlaceholder": "描述需要优先记住的信息类型,留空表示仅使用内置默认规则",
8187+
"skipRulesLabel": "应当跳过的信息",
8188+
"skipRulesHint": "例如:一次性查询问答、寒暄闲聊、临时草稿或不需要沉淀的中间调试内容。",
8189+
"skipRulesPlaceholder": "描述不需要沉淀为长期记忆的信息类型,留空表示仅使用内置默认规则",
8190+
"saveHint": "修改后,采用「继承全局」的专家会自动采用新配置;已显式自定义相应项目的专家不受影响。"
81498191
}
81508192
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
.page {
2+
display: flex;
3+
flex-direction: column;
4+
gap: 16px;
5+
width: 100%;
6+
max-width: 900px;
7+
padding-bottom: 24px;
8+
}
9+
10+
.settingCard {
11+
border-radius: 12px;
12+
13+
:global(.ant-card-body) {
14+
padding: 20px;
15+
}
16+
}
17+
18+
.sectionHeading {
19+
display: flex;
20+
align-items: center;
21+
gap: 12px;
22+
}
23+
24+
.settingIcon {
25+
display: inline-flex;
26+
align-items: center;
27+
justify-content: center;
28+
flex-shrink: 0;
29+
width: 34px;
30+
height: 34px;
31+
border-radius: 10px;
32+
color: var(--fn-color-brand);
33+
background: color-mix(in srgb, var(--fn-color-brand) 10%, transparent);
34+
}
35+
36+
.settingTitle {
37+
color: var(--fn-text-primary);
38+
font-size: 15px;
39+
font-weight: 600;
40+
}
41+
42+
.settingDescription {
43+
margin-top: 3px;
44+
color: var(--fn-text-tertiary);
45+
font-size: 12px;
46+
line-height: 1.5;
47+
}
48+
49+
.fields {
50+
display: flex;
51+
flex-direction: column;
52+
gap: 16px;
53+
margin: 18px 0 0 46px;
54+
}
55+
56+
.fieldBlock {
57+
display: flex;
58+
flex-direction: column;
59+
gap: 6px;
60+
}
61+
62+
.fieldLabel {
63+
color: var(--fn-text-primary);
64+
font-size: 13px;
65+
font-weight: 500;
66+
}
67+
68+
.fieldHint {
69+
color: var(--fn-text-tertiary);
70+
font-size: 12px;
71+
line-height: 1.5;
72+
}
73+
74+
.saveBar {
75+
position: sticky;
76+
bottom: 12px;
77+
z-index: 2;
78+
display: flex;
79+
align-items: center;
80+
justify-content: space-between;
81+
gap: 16px;
82+
padding: 12px 16px;
83+
border: 1px solid var(--fn-border-primary);
84+
border-radius: 12px;
85+
background: color-mix(in srgb, var(--fn-bg-elevated) 94%, transparent);
86+
box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
87+
backdrop-filter: blur(10px);
88+
89+
> span {
90+
color: var(--fn-text-tertiary);
91+
font-size: 12px;
92+
}
93+
}
94+
95+
@media (max-width: 767px) {
96+
.fields {
97+
margin-left: 0;
98+
}
99+
100+
.saveBar {
101+
bottom: 8px;
102+
}
103+
}

0 commit comments

Comments
 (0)